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

  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.     public function build(ContainerBuilder $container): void
  36.     {
  37.         parent::build($container);
  38.         $container->addCompilerPass(new NonFunctionalFilterExceptionPass());
  39.         $container->addCompilerPass(new AssetsVersionCompilerPass(), PassConfig::TYPE_BEFORE_REMOVING);
  40.         $container->addCompilerPass(new DriverCompilerPass());
  41.         $container->addCompilerPass(new LoadersCompilerPass());
  42.         $container->addCompilerPass(new FiltersCompilerPass());
  43.         $container->addCompilerPass(new PostProcessorsCompilerPass());
  44.         $container->addCompilerPass(new ResolversCompilerPass());
  45.         $container->addCompilerPass(new MetadataReaderCompilerPass());
  46.         $container->addCompilerPass(new MaybeSetMimeServicesAsAliasesCompilerPass());
  47.         if (class_exists(AddTopicMetaPass::class)) {
  48.             $container->addCompilerPass(AddTopicMetaPass::create()
  49.                 ->add(Topics::CACHE_RESOLVED'The topic contains messages about resolved image\'s caches')
  50.             );
  51.         }
  52.         /** @var $extension LiipImagineExtension */
  53.         $extension $container->getExtension('liip_imagine');
  54.         $extension->addResolverFactory(new WebPathResolverFactory());
  55.         $extension->addResolverFactory(new AwsS3ResolverFactory());
  56.         $extension->addResolverFactory(new FlysystemResolverFactory());
  57.         $extension->addLoaderFactory(new StreamLoaderFactory());
  58.         $extension->addLoaderFactory(new FileSystemLoaderFactory());
  59.         $extension->addLoaderFactory(new FlysystemLoaderFactory());
  60.         $extension->addLoaderFactory(new ChainLoaderFactory());
  61.     }
  62. }