vendor/coreshop/core-shop/src/CoreShop/Bundle/ThemeBundle/CoreShopThemeBundle.php line 30

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\ThemeBundle;
  17. use Composer\InstalledVersions;
  18. use CoreShop\Bundle\ThemeBundle\DependencyInjection\Compiler\CompositeThemeResolverPass;
  19. use CoreShop\Bundle\ThemeBundle\DependencyInjection\Compiler\RemoveThemeAwareTranslatorPass;
  20. use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
  21. use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
  22. use Pimcore\HttpKernel\BundleCollection\BundleCollection;
  23. use Sylius\Bundle\ThemeBundle\SyliusThemeBundle;
  24. use Symfony\Component\DependencyInjection\ContainerBuilder;
  25. class CoreShopThemeBundle extends AbstractPimcoreBundle implements DependentBundleInterface
  26. {
  27.     public static function registerDependentBundles(BundleCollection $collection): void
  28.     {
  29.         $collection->addBundle(new SyliusThemeBundle(), 1100);
  30.     }
  31.     public function build(ContainerBuilder $container): void
  32.     {
  33.         parent::build($container);
  34.         $container->addCompilerPass(new CompositeThemeResolverPass());
  35.         $container->addCompilerPass(new RemoveThemeAwareTranslatorPass());
  36.     }
  37.     public function getNiceName(): string
  38.     {
  39.         return 'CoreShop - Theme';
  40.     }
  41.     public function getDescription(): string
  42.     {
  43.         return 'CoreShop - Theme Bundle';
  44.     }
  45.     public function getVersion(): string
  46.     {
  47.         if (class_exists('\\CoreShop\\Bundle\\CoreBundle\\Application\\Version')) {
  48.             return \CoreShop\Bundle\CoreBundle\Application\Version::getVersion() . ' (' $this->getComposerVersion() . ')';
  49.         }
  50.         return $this->getComposerVersion();
  51.     }
  52.     public function getComposerVersion(): string
  53.     {
  54.         $bundleName 'coreshop/theme-bundle';
  55.         if (class_exists(InstalledVersions::class)) {
  56.             if (InstalledVersions::isInstalled('coreshop/core-shop')) {
  57.                 return InstalledVersions::getPrettyVersion('coreshop/core-shop');
  58.             }
  59.             if (InstalledVersions::isInstalled($bundleName)) {
  60.                 return InstalledVersions::getPrettyVersion($bundleName);
  61.             }
  62.         }
  63.         return '';
  64.     }
  65. }