GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#31)
by Maximilian
02:46
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 52
Code Lines 47

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 40
CRAP Score 1

Importance

Changes 6
Bugs 1 Features 1
Metric Value
c 6
b 1
f 1
dl 0
loc 52
rs 9.493
ccs 40
cts 40
cp 1
cc 1
eloc 47
nc 1
nop 0
crap 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Ma27\ApiKeyAuthenticationBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
8
9
/**
10
 * This is the class that validates and merges configuration from your app/config files.
11
 *
12
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
13
 */
14
class Configuration implements ConfigurationInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19 10
    public function getConfigTreeBuilder()
20
    {
21 10
        $treeBuilder = new TreeBuilder();
22 10
        $rootNode = $treeBuilder->root('ma27_api_key_authentication');
23
24
        $rootNode
25 10
            ->children()
26 10
                ->arrayNode('user')
27 10
                    ->children()
28 10
                        ->integerNode('api_key_length')
29 10
                            ->min(50)
30 10
                            ->defaultValue(200)
31 10
                        ->end()
32 10
                        ->scalarNode('object_manager')->isRequired()->end()
33 10
                        ->scalarNode('model_name')->defaultValue('AppBundle:User')->end()
34 10
                        ->arrayNode('password')
35 10
                            ->children()
36
                                ->scalarNode('strategy')
37
                                    ->validate()
38 9
                                        ->ifNotInArray(array('php55', 'crypt', 'sha512', 'phpass'))
39 9
                                        ->thenInvalid(
40 9
                                            'Invalid password strategy "%s"! '
41
                                            .'Allowed strategies are "password", "crypt", "sha512", "phpass"!'
42 9
                                        )
43 1
                                    ->end()
44
                                ->end()
45
                                ->integerNode('phpass_iteration_length')
46 8
                                    ->defaultValue(8)
47 1
                                ->end()
48 1
                            ->end()
49 1
                        ->end()
50 1
                    ->end()
51
                ->end()
52 1
                ->arrayNode('api_key_purge')
53
                    ->canBeEnabled()
54 1
                    ->children()
55 1
                        ->booleanNode('log_state')->defaultFalse()->end()
56 1
                        ->scalarNode('logger_service')->defaultValue('logger')->end()
57 1
                    ->end()
58 1
                ->end()
59 1
                ->arrayNode('services')
60
                    ->addDefaultsIfNotSet()
61
                    ->children()
62 7
                        ->scalarNode('auth_handler')->defaultNull()->end()
63 10
                        ->scalarNode('key_factory')->defaultNull()->end()
64 10
                        ->scalarNode('password_hasher')->defaultNull()->end()
65 10
                    ->end()
66 10
                ->end()
67 10
            ->end();
68 10
69 10
        return $treeBuilder;
70 10
    }
71
}
72