vendor/liip/imagine-bundle/LiipImagineBundle.php line 37

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the `liip/LiipImagineBundle` project.
  4.  *
  5.  * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE.md
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Liip\ImagineBundle;
  11. use Enqueue\Bundle\DependencyInjection\Compiler\AddTopicMetaPass;
  12. use Liip\ImagineBundle\Async\Topics;
  13. use Liip\ImagineBundle\DependencyInjection\Compiler\AssetsVersionCompilerPass;
  14. use Liip\ImagineBundle\DependencyInjection\Compiler\DriverCompilerPass;
  15. use Liip\ImagineBundle\DependencyInjection\Compiler\FiltersCompilerPass;
  16. use Liip\ImagineBundle\DependencyInjection\Compiler\LoadersCompilerPass;
  17. use Liip\ImagineBundle\DependencyInjection\Compiler\MaybeSetMimeServicesAsAliasesCompilerPass;
  18. use Liip\ImagineBundle\DependencyInjection\Compiler\MetadataReaderCompilerPass;
  19. use Liip\ImagineBundle\DependencyInjection\Compiler\NonFunctionalFilterExceptionPass;
  20. use Liip\ImagineBundle\DependencyInjection\Compiler\PostProcessorsCompilerPass;
  21. use Liip\ImagineBundle\DependencyInjection\Compiler\ResolversCompilerPass;
  22. use Liip\ImagineBundle\DependencyInjection\Factory\Loader\ChainLoaderFactory;
  23. use Liip\ImagineBundle\DependencyInjection\Factory\Loader\FileSystemLoaderFactory;
  24. use Liip\ImagineBundle\DependencyInjection\Factory\Loader\FlysystemLoaderFactory;
  25. use Liip\ImagineBundle\DependencyInjection\Factory\Loader\StreamLoaderFactory;
  26. use Liip\ImagineBundle\DependencyInjection\Factory\Resolver\AwsS3ResolverFactory;
  27. use Liip\ImagineBundle\DependencyInjection\Factory\Resolver\FlysystemResolverFactory;
  28. use Liip\ImagineBundle\DependencyInjection\Factory\Resolver\WebPathResolverFactory;
  29. use Liip\ImagineBundle\DependencyInjection\LiipImagineExtension;
  30. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  31. use Symfony\Component\DependencyInjection\ContainerBuilder;
  32. use Symfony\Component\HttpKernel\Bundle\Bundle;
  33. class LiipImagineBundle extends Bundle
  34. {
  35.     /**
  36.      * {@inheritdoc}
  37.      */
  38.     public function build(ContainerBuilder $container)
  39.     {
  40.         parent::build($container);
  41.         $container->addCompilerPass(new NonFunctionalFilterExceptionPass());
  42.         $container->addCompilerPass(new AssetsVersionCompilerPass(), PassConfig::TYPE_BEFORE_REMOVING);
  43.         $container->addCompilerPass(new DriverCompilerPass());
  44.         $container->addCompilerPass(new LoadersCompilerPass());
  45.         $container->addCompilerPass(new FiltersCompilerPass());
  46.         $container->addCompilerPass(new PostProcessorsCompilerPass());
  47.         $container->addCompilerPass(new ResolversCompilerPass());
  48.         $container->addCompilerPass(new MetadataReaderCompilerPass());
  49.         $container->addCompilerPass(new MaybeSetMimeServicesAsAliasesCompilerPass());
  50.         if (class_exists(AddTopicMetaPass::class)) {
  51.             $container->addCompilerPass(AddTopicMetaPass::create()
  52.                 ->add(Topics::CACHE_RESOLVED'The topic contains messages about resolved image\'s caches')
  53.             );
  54.         }
  55.         /** @var $extension LiipImagineExtension */
  56.         $extension $container->getExtension('liip_imagine');
  57.         $extension->addResolverFactory(new WebPathResolverFactory());
  58.         $extension->addResolverFactory(new AwsS3ResolverFactory());
  59.         $extension->addResolverFactory(new FlysystemResolverFactory());
  60.         $extension->addLoaderFactory(new StreamLoaderFactory());
  61.         $extension->addLoaderFactory(new FileSystemLoaderFactory());
  62.         $extension->addLoaderFactory(new FlysystemLoaderFactory());
  63.         $extension->addLoaderFactory(new ChainLoaderFactory());
  64.     }
  65. }