vendor/ibexa/http-cache/src/bundle/IbexaHttpCacheBundle.php line 19

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. namespace Ibexa\Bundle\HttpCache;
  7. use Ibexa\Bundle\HttpCache\DependencyInjection\Compiler\DriverPass;
  8. use Ibexa\Bundle\HttpCache\DependencyInjection\Compiler\KernelPass;
  9. use Ibexa\Bundle\HttpCache\DependencyInjection\Compiler\ResponseTaggersPass;
  10. use Ibexa\Bundle\HttpCache\DependencyInjection\Compiler\VarnishCachePass;
  11. use Ibexa\Bundle\HttpCache\DependencyInjection\ConfigResolver\HttpCacheConfigParser;
  12. use Ibexa\Bundle\HttpCache\DependencyInjection\IbexaHttpCacheExtension;
  13. use Symfony\Component\DependencyInjection\ContainerBuilder;
  14. use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
  15. use Symfony\Component\HttpKernel\Bundle\Bundle;
  16. class IbexaHttpCacheBundle extends Bundle
  17. {
  18.     public function build(ContainerBuilder $container)
  19.     {
  20.         parent::build($container);
  21.         $container->addCompilerPass(new ResponseTaggersPass());
  22.         $container->addCompilerPass(new KernelPass());
  23.         $container->addCompilerPass(new DriverPass());
  24.         $container->addCompilerPass(new VarnishCachePass());
  25.         $this->registerConfigParser($container);
  26.     }
  27.     public function getContainerExtensionClass()
  28.     {
  29.         return IbexaHttpCacheExtension::class;
  30.     }
  31.     public function getContainerExtension()
  32.     {
  33.         if (null === $this->extension) {
  34.             $extension $this->createContainerExtension();
  35.             if (null !== $extension) {
  36.                 if (!$extension instanceof ExtensionInterface) {
  37.                     throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.'\get_class($extension)));
  38.                 }
  39.                 $this->extension $extension;
  40.             } else {
  41.                 $this->extension false;
  42.             }
  43.         }
  44.         if ($this->extension) {
  45.             return $this->extension;
  46.         }
  47.     }
  48.     public function registerConfigParser(ContainerBuilder $container)
  49.     {
  50.         /** @var \Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension $eZExtension */
  51.         $eZExtension $container->getExtension('ibexa');
  52.         $eZExtension->addConfigParser(
  53.             new HttpCacheConfigParser(
  54.                 $container->getExtension('ibexa_http_cache')
  55.             )
  56.         );
  57.     }
  58. }
  59. class_alias(IbexaHttpCacheBundle::class, 'EzSystems\PlatformHttpCacheBundle\EzSystemsPlatformHttpCacheBundle');