Aws3ResolverFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 7
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getKey() 0 4 1
A addConfiguration() 0 10 1
A create() 0 9 1
1
<?php
2
3
/**
4
 * Copyright 2014 Jonathan Bouzekri. All rights reserved.
5
 *
6
 * @copyright Copyright 2014 Jonathan Bouzekri <[email protected]>
7
 * @license https://github.com/jbouzekri/FileUploaderBundle/blob/master/LICENSE
8
 * @link https://github.com/jbouzekri/FileUploaderBundle
9
 */
10
11
/**
12
 * @namespace
13
 */
14
namespace Jb\Bundle\FileUploaderBundle\DependencyInjection\ResolverFactory;
15
16
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\DependencyInjection\DefinitionDecorator;
19
use Symfony\Component\DependencyInjection\Reference;
20
21
/**
22
 * Class Aws3ResolverFactory
23
 *
24
 * @author jobou
25
 * @package Jb\Bundle\FileUploaderBundle\DependencyInjection\ResolverFactory
26
 */
27
class Aws3ResolverFactory implements ResolverFactoryInterface
28
{
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function getKey()
33
    {
34
        return 'aws3';
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function addConfiguration(ArrayNodeDefinition $node)
41
    {
42
        $node
43
            ->children()
44
                ->scalarNode('service_id')->isRequired()->cannotBeEmpty()->end()
45
                ->scalarNode('bucket')->isRequired()->cannotBeEmpty()->end()
46
                ->scalarNode('directory')->defaultValue(null)->end()
47
            ->end()
48
        ;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function create(ContainerBuilder $container, $id, array $config)
55
    {
56
        $container
57
            ->setDefinition($id, new DefinitionDecorator('jb_fileuploader.resolver.aws3.prototype'))
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Depend...ion\DefinitionDecorator has been deprecated with message: The DefinitionDecorator class is deprecated since version 3.3 and will be removed in 4.0. Use the Symfony\Component\DependencyInjection\ChildDefinition class instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
58
            ->addArgument(new Reference($config['service_id']))
59
            ->addArgument($config['bucket'])
60
            ->addArgument($config['directory'])
61
        ;
62
    }
63
}
64