| @@ 25-58 (lines=34) @@ | ||
| 22 | * | |
| 23 | * @author jobou | |
| 24 | */ | |
| 25 | class AssetsResolverFactory implements ResolverFactoryInterface | |
| 26 | { | |
| 27 | /** | |
| 28 |      * {@inheritdoc} | |
| 29 | */ | |
| 30 | public function getKey() | |
| 31 |     { | |
| 32 | return 'assets'; | |
| 33 | } | |
| 34 | ||
| 35 | /** | |
| 36 |      * {@inheritdoc} | |
| 37 | */ | |
| 38 | public function addConfiguration(ArrayNodeDefinition $node) | |
| 39 |     { | |
| 40 | $node | |
| 41 | ->children() | |
| 42 |                 ->scalarNode('directory')->isRequired()->cannotBeEmpty()->end() | |
| 43 | ->end() | |
| 44 | ; | |
| 45 | } | |
| 46 | ||
| 47 | /** | |
| 48 |      * {@inheritdoc} | |
| 49 | */ | |
| 50 | public function create(ContainerBuilder $container, $id, array $config) | |
| 51 |     { | |
| 52 | $container | |
| 53 |             ->setDefinition($id, new DefinitionDecorator('jb_fileuploader.resolver.asset.prototype')) | |
| 54 |             ->setScope('request') | |
| 55 | ->addArgument($config['directory']) | |
| 56 | ; | |
| 57 | } | |
| 58 | } | |
| 59 | ||
| @@ 18-51 (lines=34) @@ | ||
| 15 | * | |
| 16 | * @author jobou | |
| 17 | */ | |
| 18 | class CdnResolverFactory implements ResolverFactoryInterface | |
| 19 | { | |
| 20 | /** | |
| 21 |      * {@inheritdoc} | |
| 22 | */ | |
| 23 | public function getKey() | |
| 24 |     { | |
| 25 | return 'cdn'; | |
| 26 | } | |
| 27 | ||
| 28 | /** | |
| 29 |      * {@inheritdoc} | |
| 30 | */ | |
| 31 | public function addConfiguration(ArrayNodeDefinition $node) | |
| 32 |     { | |
| 33 | $node | |
| 34 | ->children() | |
| 35 |                 ->scalarNode('url')->isRequired()->cannotBeEmpty()->end() | |
| 36 | ->end() | |
| 37 | ; | |
| 38 | } | |
| 39 | ||
| 40 | /** | |
| 41 |      * {@inheritdoc} | |
| 42 | */ | |
| 43 | public function create(ContainerBuilder $container, $id, array $config) | |
| 44 |     { | |
| 45 | $container | |
| 46 |             ->setDefinition($id, new DefinitionDecorator('jb_fileuploader.resolver.cdn.prototype')) | |
| 47 |             ->setScope('request') | |
| 48 | ->addArgument($config['url']) | |
| 49 | ; | |
| 50 | } | |
| 51 | } | |
| 52 | ||