vendor/contao/manager-plugin/src/PluginLoader.php line 50

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * This file is part of Contao.
  5.  *
  6.  * (c) Leo Feyer
  7.  *
  8.  * @license LGPL-3.0-or-later
  9.  */
  10. namespace Contao\ManagerPlugin;
  11. use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
  12. use Contao\ManagerPlugin\Config\ConfigPluginInterface;
  13. use Contao\ManagerPlugin\Config\ExtensionPluginInterface;
  14. use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
  15. /**
  16.  * This class has been auto-generated. It will be overwritten at every run of
  17.  * "composer install" or "composer update".
  18.  *
  19.  * @see \Contao\ManagerPlugin\Composer\Installer
  20.  */
  21. class PluginLoader
  22. {
  23.     public const BUNDLE_PLUGINS BundlePluginInterface::class;
  24.     public const CONFIG_PLUGINS ConfigPluginInterface::class;
  25.     public const EXTENSION_PLUGINS ExtensionPluginInterface::class;
  26.     public const ROUTING_PLUGINS RoutingPluginInterface::class;
  27.     /**
  28.      * @var array
  29.      */
  30.     private $plugins;
  31.     /**
  32.      * @var array
  33.      */
  34.     private $disabled = [];
  35.     public function __construct(string $installedJson null, array $plugins null)
  36.     {
  37.         if (null !== $installedJson) {
  38.             @trigger_error('Passing the path to the Composer installed.json as first argument is no longer supported in version 2.3.'E_USER_DEPRECATED);
  39.         }
  40.         $this->plugins $plugins ?: [
  41.             'codefog/tags-bundle' => new \Codefog\TagsBundle\ContaoManager\Plugin(),
  42.             'markenzoo/contao-file-helper-bundle' => new \Markenzoo\ContaoFileHelperBundle\ContaoManager\Plugin(),
  43.             'rhymedigital/contao_backend_rhyme' => new \Rhyme\ContaoBackendThemeBundle\ContaoManager\Plugin(),
  44.             'rhymedigital/contao_video_manager' => new \Rhyme\VideoManagerBundle\ContaoManager\Plugin(),
  45.             'terminal42/contao-node' => new \Terminal42\NodeBundle\ContaoManager\Plugin(),
  46.             'contao/calendar-bundle' => new \Contao\CalendarBundle\ContaoManager\Plugin(),
  47.             'contao/listing-bundle' => new \Contao\ListingBundle\ContaoManager\Plugin(),
  48.             'contao/installation-bundle' => new \Contao\InstallationBundle\ContaoManager\Plugin(),
  49.             'contao/core-bundle' => new \Contao\CoreBundle\ContaoManager\Plugin(),
  50.             'contao/news-bundle' => new \Contao\NewsBundle\ContaoManager\Plugin(),
  51.             'contao/newsletter-bundle' => new \Contao\NewsletterBundle\ContaoManager\Plugin(),
  52.             'madeyourday/contao-rocksolid-custom-elements' => new \MadeYourDay\RockSolidCustomElements\ContaoManagerPlugin(),
  53.             'numero2/contao-opengraph3' => new \numero2\Opengraph3Bundle\ContaoManager\Plugin(),
  54.             'contao/manager-bundle' => new \Contao\ManagerBundle\ContaoManager\Plugin(),
  55.             'app' => new \App\ContaoManager\Plugin(),
  56.         ];
  57.     }
  58.     /**
  59.      * Returns all active plugin instances.
  60.      *
  61.      * @return array<string,BundlePluginInterface>
  62.      */
  63.     public function getInstances(): array
  64.     {
  65.         return array_diff_key($this->pluginsarray_flip($this->disabled));
  66.     }
  67.     /**
  68.      * Returns the active plugin instances of a given type (see class constants).
  69.      *
  70.      * @return array<string,BundlePluginInterface>
  71.      */
  72.     public function getInstancesOf(string $typebool $reverseOrder false): array
  73.     {
  74.         $plugins array_filter(
  75.             $this->getInstances(),
  76.             function ($plugin) use ($type) {
  77.                 return is_a($plugin$type);
  78.             }
  79.         );
  80.         if ($reverseOrder) {
  81.             $plugins array_reverse($pluginstrue);
  82.         }
  83.         return array_diff_key($pluginsarray_flip($this->disabled));
  84.     }
  85.     /**
  86.      * @return string[]
  87.      */
  88.     public function getDisabledPackages(): array
  89.     {
  90.         return $this->disabled;
  91.     }
  92.     public function setDisabledPackages(array $packages): void
  93.     {
  94.         $this->disabled $packages;
  95.     }
  96. }