vendor/shopware/core/Framework/Plugin/BundleConfigDumper.php line 37

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Plugin;
  3. use Shopware\Core\Framework\Plugin\Event\PluginPostActivateEvent;
  4. use Shopware\Core\Framework\Plugin\Event\PluginPostDeactivateEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class BundleConfigDumper implements EventSubscriberInterface
  7. {
  8.     /**
  9.      * @var BundleConfigGeneratorInterface
  10.      */
  11.     private $bundleConfigGenerator;
  12.     /**
  13.      * @var string
  14.      */
  15.     private $cacheDir;
  16.     public function __construct(
  17.         BundleConfigGeneratorInterface $bundleConfigGenerator,
  18.         string $cacheDir
  19.     ) {
  20.         $this->bundleConfigGenerator $bundleConfigGenerator;
  21.         $this->cacheDir $cacheDir;
  22.     }
  23.     public static function getSubscribedEvents(): array
  24.     {
  25.         return [
  26.             PluginPostActivateEvent::class => 'dump',
  27.             PluginPostDeactivateEvent::class => 'dump',
  28.         ];
  29.     }
  30.     public function dump(): void
  31.     {
  32.         $config $this->bundleConfigGenerator->getConfig();
  33.         file_put_contents(
  34.             $this->cacheDir '/../../plugins.json',
  35.             json_encode($configJSON_PRETTY_PRINT)
  36.         );
  37.     }
  38. }