vendor/pimcore/pimcore/lib/HttpKernel/BundleCollection/Item.php line 78

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * Pimcore
  5.  *
  6.  * This source file is available under two different licenses:
  7.  * - GNU General Public License version 3 (GPLv3)
  8.  * - Pimcore Commercial License (PCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  13.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  14.  */
  15. namespace Pimcore\HttpKernel\BundleCollection;
  16. use Pimcore\Extension\Bundle\PimcoreBundleInterface;
  17. use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
  18. use Symfony\Component\HttpKernel\Bundle\BundleInterface;
  19. class Item extends AbstractItem
  20. {
  21.     /**
  22.      * @var BundleInterface
  23.      */
  24.     private $bundle;
  25.     /**
  26.      * @param BundleInterface $bundle
  27.      * @param int $priority
  28.      * @param array $environments
  29.      * @param string $source
  30.      */
  31.     public function __construct(
  32.         BundleInterface $bundle,
  33.         int $priority 0,
  34.         array $environments = [],
  35.         string $source self::SOURCE_PROGRAMATICALLY
  36.     ) {
  37.         $this->bundle $bundle;
  38.         parent::__construct($priority$environments$source);
  39.     }
  40.     /**
  41.      * @return string
  42.      */
  43.     public function getBundleIdentifier(): string
  44.     {
  45.         return get_class($this->bundle);
  46.     }
  47.     /**
  48.      * @return BundleInterface
  49.      */
  50.     public function getBundle(): BundleInterface
  51.     {
  52.         return $this->bundle;
  53.     }
  54.     /**
  55.      * @return bool
  56.      */
  57.     public function isPimcoreBundle(): bool
  58.     {
  59.         return $this->bundle instanceof PimcoreBundleInterface;
  60.     }
  61.     /**
  62.      * @param BundleCollection $collection
  63.      */
  64.     public function registerDependencies(BundleCollection $collection)
  65.     {
  66.         if ($this->bundle instanceof DependentBundleInterface) {
  67.             $this->bundle::registerDependentBundles($collection);
  68.         }
  69.     }
  70. }