| @@ 14-51 (lines=38) @@ | ||
| 11 | /** |
|
| 12 | * @author Kevin Bond <[email protected]> |
|
| 13 | */ |
|
| 14 | class FlysystemDestinationFactory implements Factory |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * {@inheritdoc} |
|
| 18 | */ |
|
| 19 | public function getName() |
|
| 20 | { |
|
| 21 | return 'flysystem'; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * {@inheritdoc} |
|
| 26 | */ |
|
| 27 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 28 | { |
|
| 29 | $serviceId = sprintf('zenstruck_backup.destination.%s', $id); |
|
| 30 | ||
| 31 | $container->setDefinition($serviceId, new DefinitionDecorator('zenstruck_backup.destination.abstract_flysystem')) |
|
| 32 | ->replaceArgument(0, $id) |
|
| 33 | ->replaceArgument(1, new Reference($config['filesystem_service'])) |
|
| 34 | ->addTag('zenstruck_backup.destination') |
|
| 35 | ; |
|
| 36 | ||
| 37 | return new Reference($serviceId); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function addConfiguration(ArrayNodeDefinition $builder) |
|
| 44 | { |
|
| 45 | $builder |
|
| 46 | ->children() |
|
| 47 | ->scalarNode('filesystem_service')->isRequired()->end() |
|
| 48 | ->end() |
|
| 49 | ; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 14-51 (lines=38) @@ | ||
| 11 | /** |
|
| 12 | * @author Kevin Bond <[email protected]> |
|
| 13 | */ |
|
| 14 | class StreamDestinationFactory implements Factory |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * {@inheritdoc} |
|
| 18 | */ |
|
| 19 | public function getName() |
|
| 20 | { |
|
| 21 | return 'stream'; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * {@inheritdoc} |
|
| 26 | */ |
|
| 27 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 28 | { |
|
| 29 | $serviceId = sprintf('zenstruck_backup.destination.%s', $id); |
|
| 30 | ||
| 31 | $container->setDefinition($serviceId, new DefinitionDecorator('zenstruck_backup.destination.abstract_stream')) |
|
| 32 | ->replaceArgument(0, $id) |
|
| 33 | ->replaceArgument(1, $config['directory']) |
|
| 34 | ->addTag('zenstruck_backup.destination') |
|
| 35 | ; |
|
| 36 | ||
| 37 | return new Reference($serviceId); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function addConfiguration(ArrayNodeDefinition $builder) |
|
| 44 | { |
|
| 45 | $builder |
|
| 46 | ->children() |
|
| 47 | ->scalarNode('directory')->isRequired()->end() |
|
| 48 | ->end() |
|
| 49 | ; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 15-51 (lines=37) @@ | ||
| 12 | /** |
|
| 13 | * @author Kevin Bond <[email protected]> |
|
| 14 | */ |
|
| 15 | class SimpleNamerFactory implements Factory |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * {@inheritdoc} |
|
| 19 | */ |
|
| 20 | public function getName() |
|
| 21 | { |
|
| 22 | return 'simple'; |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * {@inheritdoc} |
|
| 27 | */ |
|
| 28 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 29 | { |
|
| 30 | $serviceId = sprintf('zenstruck_backup.namer.%s', $id); |
|
| 31 | ||
| 32 | $container->setDefinition($serviceId, new DefinitionDecorator('zenstruck_backup.namer.abstract_simple')) |
|
| 33 | ->replaceArgument(0, $config['name']) |
|
| 34 | ->addTag('zenstruck_backup.namer') |
|
| 35 | ; |
|
| 36 | ||
| 37 | return new Reference($serviceId); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function addConfiguration(ArrayNodeDefinition $builder) |
|
| 44 | { |
|
| 45 | $builder |
|
| 46 | ->children() |
|
| 47 | ->scalarNode('name')->defaultValue(SimpleNamer::DEFAULT_NAME)->end() |
|
| 48 | ->end() |
|
| 49 | ; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||