<?php
declare(strict_types=1);
namespace App\Component\GenerateFeed\EventSubscriber;
use App\Component\GenerateFeed\Event\PreWriteFeedFile;
use App\Util\StringUtil;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CleanupFeedSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
PreWriteFeedFile::class => ['removeUnicode'],
];
}
public function removeUnicode(PreWriteFeedFile $event): void
{
$event->setParsedContents(StringUtil::removeNonPrintableCharacters($event->getParsedContents()));
}
}