ProjectExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 48
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 3 1
A load() 0 7 1
A configure() 0 16 1
A getName() 0 4 1
1
<?php
2
3
namespace Openl10n\Cli\ServiceContainer\Extension;
4
5
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
class ProjectExtension implements ConfiguredExtension
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function initialize(ContainerBuilder $container)
14
    {
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function load(array $config, ContainerBuilder $container)
21
    {
22
        $container
23
            ->register('project_handler', 'Openl10n\Cli\Project\ProjectHandler')
24
            ->addArgument($config['slug'])
25
        ;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function configure(ArrayNodeDefinition $node)
32
    {
33
        $node
34
            ->beforeNormalization()
35
            ->ifString()
36
                ->then(function ($v) { return array(
37
                    'slug' => $v
38
                ); })
39
            ->end()
40
            ->children()
41
                ->scalarNode('slug')
42
                    ->isRequired()
43
                    ->cannotBeEmpty()
44
                ->end()
45
            ->end();
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getName()
52
    {
53
        return 'project';
54
    }
55
}
56