Configuration::getTokensNode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 30
c 0
b 0
f 0
ccs 24
cts 24
cp 1
rs 9.44
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Yokai\SecurityTokenBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
/**
10
 * @author Yann Eugoné <[email protected]>
11
 */
12
class Configuration implements ConfigurationInterface
13
{
14
    /**
15
     * @inheritdoc
16
     */
17 4
    public function getConfigTreeBuilder()
18
    {
19 4
        $builder = new TreeBuilder();
0 ignored issues
show
Bug introduced by
The call to TreeBuilder::__construct() misses a required argument $name.

This check looks for function calls that miss required arguments.

Loading history...
20 4
        $root = $builder->root('yokai_security_token');
0 ignored issues
show
Bug introduced by
The method root() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
22 4
        $root->addDefaultsIfNotSet();
23
        $root
24 4
            ->children()
25 4
                ->append($this->getTokensNode())
26 4
                ->append($this->getServicesNode())
27 4
            ->end()
28
        ;
29
30 4
        return $builder;
31
    }
32
33
    /**
34
     * @return NodeDefinition
35
     */
36 4
    private function getTokensNode()
37
    {
38 4
        $builder = new TreeBuilder();
0 ignored issues
show
Bug introduced by
The call to TreeBuilder::__construct() misses a required argument $name.

This check looks for function calls that miss required arguments.

Loading history...
39 4
        $node = $builder->root('tokens');
0 ignored issues
show
Bug introduced by
The method root() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
41
        $node
42 4
            ->useAttributeAsKey('purpose')
43 4
            ->prototype('array')
44 4
                ->children()
45 4
                    ->scalarNode('generator')
46 4
                        ->defaultValue('yokai_security_token.open_ssl_token_generator')
47 4
                    ->end()
48 4
                    ->scalarNode('duration')
49 4
                        ->defaultValue('+2 days')
50 4
                    ->end()
51 4
                    ->integerNode('usages')
52 4
                        ->defaultValue(1)
53 4
                    ->end()
54 4
                    ->scalarNode('keep')
55 4
                        ->defaultValue('+1 month')
56 4
                    ->end()
57 4
                    ->booleanNode('unique')
58 4
                        ->defaultValue(false)
59 4
                    ->end()
60 4
                ->end()
61 4
            ->end()
62
        ;
63
64 4
        return $node;
65
    }
66
67
    /**
68
     * @return NodeDefinition
69
     */
70 4
    private function getServicesNode()
71
    {
72 4
        $builder = new TreeBuilder();
0 ignored issues
show
Bug introduced by
The call to TreeBuilder::__construct() misses a required argument $name.

This check looks for function calls that miss required arguments.

Loading history...
73 4
        $node = $builder->root('services');
0 ignored issues
show
Bug introduced by
The method root() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
74
75 4
        $node->addDefaultsIfNotSet();
76
        $node
77 4
            ->children()
78 4
                ->scalarNode('information_guesser')
79 4
                    ->defaultValue('yokai_security_token.default_information_guesser')
80 4
                ->end()
81 4
                ->scalarNode('token_factory')
82 4
                    ->defaultValue('yokai_security_token.default_token_factory')
83 4
                ->end()
84 4
                ->scalarNode('token_repository')
85 4
                    ->defaultValue('yokai_security_token.default_token_repository')
86 4
                ->end()
87 4
                ->scalarNode('token_manager')
88 4
                    ->defaultValue('yokai_security_token.default_token_manager')
89 4
                ->end()
90 4
                ->scalarNode('archivist')
91 4
                    ->defaultValue('yokai_security_token.delete_archivist')
92 4
                ->end()
93 4
            ->end()
94
        ;
95
96 4
        return $node;
97
    }
98
}
99