vendor/coreshop/core-shop/src/CoreShop/Bundle/MenuBundle/CoreShopMenuBundle.php line 29

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * CoreShop
  5.  *
  6.  * This source file is available under two different licenses:
  7.  *  - GNU General Public License version 3 (GPLv3)
  8.  *  - CoreShop Commercial License (CCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  * @copyright  Copyright (c) CoreShop GmbH (https://www.coreshop.org)
  13.  * @license    https://www.coreshop.org/license     GPLv3 and CCL
  14.  *
  15.  */
  16. namespace CoreShop\Bundle\MenuBundle;
  17. use Composer\InstalledVersions;
  18. use CoreShop\Bundle\MenuBundle\DependencyInjection\CompilerPass\MenuBuilderPass;
  19. use Knp\Bundle\MenuBundle\KnpMenuBundle;
  20. use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
  21. use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
  22. use Pimcore\HttpKernel\BundleCollection\BundleCollection;
  23. use Symfony\Component\DependencyInjection\ContainerBuilder;
  24. final class CoreShopMenuBundle extends AbstractPimcoreBundle implements DependentBundleInterface
  25. {
  26.     public static function registerDependentBundles(BundleCollection $collection): void
  27.     {
  28.         $collection->addBundle(new KnpMenuBundle());
  29.     }
  30.     public function build(ContainerBuilder $container): void
  31.     {
  32.         parent::build($container);
  33.         $container->addCompilerPass(new MenuBuilderPass());
  34.     }
  35.     public function getVersion(): string
  36.     {
  37.         if (class_exists('\\CoreShop\\Bundle\\CoreBundle\\Application\\Version')) {
  38.             return \CoreShop\Bundle\CoreBundle\Application\Version::getVersion() . ' (' $this->getComposerVersion() . ')';
  39.         }
  40.         return $this->getComposerVersion();
  41.     }
  42.     public function getComposerVersion(): string
  43.     {
  44.         $bundleName 'coreshop/menu-bundle';
  45.         if (class_exists(InstalledVersions::class)) {
  46.             if (InstalledVersions::isInstalled('coreshop/core-shop')) {
  47.                 return InstalledVersions::getPrettyVersion('coreshop/core-shop');
  48.             }
  49.             if (InstalledVersions::isInstalled($bundleName)) {
  50.                 return InstalledVersions::getPrettyVersion($bundleName);
  51.             }
  52.         }
  53.         return '';
  54.     }
  55.     public function getNiceName(): string
  56.     {
  57.         return 'CoreShop - Menu';
  58.     }
  59.     public function getDescription(): string
  60.     {
  61.         return 'CoreShop - Menu Bundle';
  62.     }
  63.     public function getPackageName(): string
  64.     {
  65.         return 'coreshop/pimcore-bundle';
  66.     }
  67. }