| @@ 18-58 (lines=41) @@ | ||
| 15 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
| 16 | use Symfony\Component\DependencyInjection\Reference; |
|
| 17 | ||
| 18 | class FlysystemLoaderFactory extends AbstractLoaderFactory |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * {@inheritdoc} |
|
| 22 | */ |
|
| 23 | public function create(ContainerBuilder $container, $loaderName, array $config) |
|
| 24 | { |
|
| 25 | $definition = $this->getChildLoaderDefinition(); |
|
| 26 | ||
| 27 | if ($container->hasDefinition('liip_imagine.mime_types')) { |
|
| 28 | $mimeTypes = $container->getDefinition('liip_imagine.mime_types'); |
|
| 29 | $definition->replaceArgument(0, $mimeTypes); |
|
| 30 | } |
|
| 31 | ||
| 32 | $definition->replaceArgument(1, new Reference($config['filesystem_service'])); |
|
| 33 | ||
| 34 | return $this->setTaggedLoaderDefinition($loaderName, $definition, $container); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * {@inheritdoc} |
|
| 39 | */ |
|
| 40 | public function getName() |
|
| 41 | { |
|
| 42 | return 'flysystem'; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * {@inheritdoc} |
|
| 47 | */ |
|
| 48 | public function addConfiguration(ArrayNodeDefinition $builder) |
|
| 49 | { |
|
| 50 | $builder |
|
| 51 | ->children() |
|
| 52 | ->scalarNode('filesystem_service') |
|
| 53 | ->isRequired() |
|
| 54 | ->cannotBeEmpty() |
|
| 55 | ->end() |
|
| 56 | ->end(); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| @@ 18-58 (lines=41) @@ | ||
| 15 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
| 16 | use Symfony\Component\DependencyInjection\Reference; |
|
| 17 | ||
| 18 | class FlysystemV2LoaderFactory extends AbstractLoaderFactory |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * {@inheritdoc} |
|
| 22 | */ |
|
| 23 | public function create(ContainerBuilder $container, $loaderName, array $config) |
|
| 24 | { |
|
| 25 | $definition = $this->getChildLoaderDefinition(); |
|
| 26 | ||
| 27 | if ($container->hasDefinition('liip_imagine.mime_types')) { |
|
| 28 | $mimeTypes = $container->getDefinition('liip_imagine.mime_types'); |
|
| 29 | $definition->replaceArgument(0, $mimeTypes); |
|
| 30 | } |
|
| 31 | ||
| 32 | $definition->replaceArgument(1, new Reference($config['filesystem_service'])); |
|
| 33 | ||
| 34 | return $this->setTaggedLoaderDefinition($loaderName, $definition, $container); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * {@inheritdoc} |
|
| 39 | */ |
|
| 40 | public function getName() |
|
| 41 | { |
|
| 42 | return 'flysystem2'; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * {@inheritdoc} |
|
| 47 | */ |
|
| 48 | public function addConfiguration(ArrayNodeDefinition $builder) |
|
| 49 | { |
|
| 50 | $builder |
|
| 51 | ->children() |
|
| 52 | ->scalarNode('filesystem_service') |
|
| 53 | ->isRequired() |
|
| 54 | ->cannotBeEmpty() |
|
| 55 | ->end() |
|
| 56 | ->end(); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||