vendor/pimcore/pimcore/bundles/CoreBundle/src/PimcoreCoreBundle.php line 43

  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\Bundle\CoreBundle;
  16. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\AreabrickPass;
  17. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\CacheFallbackPass;
  18. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\FlysystemVisibilityPass;
  19. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\HtmlSanitizerPass;
  20. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\LongRunningHelperPass;
  21. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\MessageBusPublicPass;
  22. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\MonologPsrLogMessageProcessorPass;
  23. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\MonologPublicLoggerPass;
  24. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\NavigationRendererPass;
  25. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\ProfilerAliasPass;
  26. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\RegisterImageOptimizersPass;
  27. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\RegisterMaintenanceTaskPass;
  28. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\RoutingLoaderPass;
  29. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\SerializerPass;
  30. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\ServiceControllersPass;
  31. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\TranslationSanitizerPass;
  32. use Pimcore\Bundle\CoreBundle\DependencyInjection\Compiler\WorkflowPass;
  33. use Symfony\Component\DependencyInjection\ContainerBuilder;
  34. use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
  35. use Symfony\Component\HttpKernel\Bundle\Bundle;
  36. /**
  37.  * @internal
  38.  */
  39. class PimcoreCoreBundle extends Bundle
  40. {
  41.     public function getContainerExtension(): ?ExtensionInterface
  42.     {
  43.         if (null === $this->extension) {
  44.             $extension $this->createContainerExtension();
  45.             if (null !== $extension) {
  46.                 if (!$extension instanceof ExtensionInterface) {
  47.                     throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.'get_class($extension)));
  48.                 }
  49.                 $this->extension $extension;
  50.             } else {
  51.                 $this->extension false;
  52.             }
  53.         }
  54.         if ($this->extension) {
  55.             return $this->extension;
  56.         }
  57.         return null;
  58.     }
  59.     /**
  60.      * {@inheritdoc}
  61.      */
  62.     public function build(ContainerBuilder $container): void
  63.     {
  64.         $container->addCompilerPass(new AreabrickPass());
  65.         $container->addCompilerPass(new NavigationRendererPass());
  66.         $container->addCompilerPass(new ServiceControllersPass());
  67.         $container->addCompilerPass(new MonologPublicLoggerPass());
  68.         $container->addCompilerPass(new MonologPsrLogMessageProcessorPass());
  69.         $container->addCompilerPass(new LongRunningHelperPass());
  70.         $container->addCompilerPass(new WorkflowPass());
  71.         $container->addCompilerPass(new RegisterImageOptimizersPass());
  72.         $container->addCompilerPass(new RegisterMaintenanceTaskPass());
  73.         $container->addCompilerPass(new RoutingLoaderPass());
  74.         $container->addCompilerPass(new ProfilerAliasPass());
  75.         $container->addCompilerPass(new CacheFallbackPass());
  76.         $container->addCompilerPass(new MessageBusPublicPass());
  77.         $container->addCompilerPass(new HtmlSanitizerPass());
  78.         $container->addCompilerPass(new TranslationSanitizerPass());
  79.         $container->addCompilerPass(new SerializerPass());
  80.         $container->addCompilerPass(new FlysystemVisibilityPass());
  81.     }
  82.     public function getPath(): string
  83.     {
  84.         return \dirname(__DIR__);
  85.     }
  86. }