| @@ 17-57 (lines=41) @@ | ||
| 14 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
| 15 | use Symfony\Component\DependencyInjection\Reference; |
|
| 16 | ||
| 17 | class FiltersCompilerPass extends AbstractCompilerPass |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | private $tagName; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @var string |
|
| 26 | */ |
|
| 27 | private $service; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param string $loadersTagName |
|
| 31 | * @param string $managerService |
|
| 32 | */ |
|
| 33 | public function __construct( |
|
| 34 | string $loadersTagName = 'liip_imagine.filter.loader', |
|
| 35 | string $managerService = 'liip_imagine.filter.manager' |
|
| 36 | ) { |
|
| 37 | $this->tagName = $loadersTagName; |
|
| 38 | $this->service = $managerService; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * {@inheritdoc} |
|
| 43 | */ |
|
| 44 | public function process(ContainerBuilder $container): void |
|
| 45 | { |
|
| 46 | $loaders = $container->findTaggedServiceIds($this->tagName); |
|
| 47 | ||
| 48 | if (0 < count($loaders) && $container->hasDefinition($this->service)) { |
|
| 49 | $manager = $container->getDefinition($this->service); |
|
| 50 | ||
| 51 | foreach ($loaders as $id => $tag) { |
|
| 52 | $manager->addMethodCall('addLoader', [$tag[0]['loader'], new Reference($id)]); |
|
| 53 | $this->log($container, 'Registered filter loader: %s', $id); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 17-57 (lines=41) @@ | ||
| 14 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
| 15 | use Symfony\Component\DependencyInjection\Reference; |
|
| 16 | ||
| 17 | class LoadersCompilerPass extends AbstractCompilerPass |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | private $tagName; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @var string |
|
| 26 | */ |
|
| 27 | private $service; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param string $loadersTagName |
|
| 31 | * @param string $managerService |
|
| 32 | */ |
|
| 33 | public function __construct( |
|
| 34 | string $loadersTagName = 'liip_imagine.binary.loader', |
|
| 35 | string $managerService = 'liip_imagine.data.manager' |
|
| 36 | ) { |
|
| 37 | $this->tagName = $loadersTagName; |
|
| 38 | $this->service = $managerService; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * {@inheritdoc} |
|
| 43 | */ |
|
| 44 | public function process(ContainerBuilder $container): void |
|
| 45 | { |
|
| 46 | $loaders = $container->findTaggedServiceIds($this->tagName); |
|
| 47 | ||
| 48 | if (0 < count($loaders) && $container->hasDefinition($this->service)) { |
|
| 49 | $manager = $container->getDefinition($this->service); |
|
| 50 | ||
| 51 | foreach ($loaders as $id => $tag) { |
|
| 52 | $manager->addMethodCall('addLoader', [$tag[0]['loader'], new Reference($id)]); |
|
| 53 | $this->log($container, 'Registered binary loader: %s', $id); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 22-62 (lines=41) @@ | ||
| 19 | * |
|
| 20 | * @author Konstantin Tjuterev <[email protected]> |
|
| 21 | */ |
|
| 22 | class PostProcessorsCompilerPass extends AbstractCompilerPass |
|
| 23 | { |
|
| 24 | /** |
|
| 25 | * @var string |
|
| 26 | */ |
|
| 27 | private $tagName; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @var string |
|
| 31 | */ |
|
| 32 | private $service; |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param string $filterTagName |
|
| 36 | * @param string $managerIdName |
|
| 37 | */ |
|
| 38 | public function __construct( |
|
| 39 | string $filterTagName = 'liip_imagine.filter.post_processor', |
|
| 40 | string $managerIdName = 'liip_imagine.filter.manager' |
|
| 41 | ) { |
|
| 42 | $this->tagName = $filterTagName; |
|
| 43 | $this->service = $managerIdName; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function process(ContainerBuilder $container): void |
|
| 50 | { |
|
| 51 | $filters = $container->findTaggedServiceIds($this->tagName); |
|
| 52 | ||
| 53 | if (0 < count($filters) && $container->hasDefinition($this->service)) { |
|
| 54 | $manager = $container->getDefinition($this->service); |
|
| 55 | ||
| 56 | foreach ($filters as $id => $tag) { |
|
| 57 | $manager->addMethodCall('addPostProcessor', [$tag[0]['post_processor'], new Reference($id)]); |
|
| 58 | $this->log($container, 'Registered filter post-processor: %s', $id); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| @@ 17-57 (lines=41) @@ | ||
| 14 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
| 15 | use Symfony\Component\DependencyInjection\Reference; |
|
| 16 | ||
| 17 | class ResolversCompilerPass extends AbstractCompilerPass |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | private $tagName; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @var string |
|
| 26 | */ |
|
| 27 | private $service; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param string $resolverTagName |
|
| 31 | * @param string $managerServiceId |
|
| 32 | */ |
|
| 33 | public function __construct( |
|
| 34 | string $resolverTagName = 'liip_imagine.cache.resolver', |
|
| 35 | string $managerServiceId = 'liip_imagine.cache.manager' |
|
| 36 | ) { |
|
| 37 | $this->tagName = $resolverTagName; |
|
| 38 | $this->service = $managerServiceId; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * {@inheritdoc} |
|
| 43 | */ |
|
| 44 | public function process(ContainerBuilder $container): void |
|
| 45 | { |
|
| 46 | $resolvers = $container->findTaggedServiceIds($this->tagName); |
|
| 47 | ||
| 48 | if (0 < count($resolvers) && $container->hasDefinition($this->service)) { |
|
| 49 | $manager = $container->getDefinition($this->service); |
|
| 50 | ||
| 51 | foreach ($resolvers as $id => $tag) { |
|
| 52 | $manager->addMethodCall('addResolver', [$tag[0]['resolver'], new Reference($id)]); |
|
| 53 | $this->log($container, 'Registered cache resolver: %s', $id); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||