<?php declare(strict_types=1); 
 
namespace Shopware\Core\Framework\App\Subscriber; 
 
use Shopware\Core\Framework\App\AppEntity; 
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent; 
use Symfony\Component\EventDispatcher\EventSubscriberInterface; 
 
/** 
 * @internal only for use by the app-system, will be considered internal from v6.4.0 onward 
 */ 
class AppLoadedSubscriber implements EventSubscriberInterface 
{ 
    public static function getSubscribedEvents(): array 
    { 
        return [ 
            'app.loaded' => 'unserialize', 
        ]; 
    } 
 
    public function unserialize(EntityLoadedEvent $event): void 
    { 
        /** @var AppEntity $app */ 
        foreach ($event->getEntities() as $app) { 
            $iconRaw = $app->getIconRaw(); 
 
            if ($iconRaw !== null) { 
                $app->setIcon(base64_encode($iconRaw)); 
            } 
        } 
    } 
}