| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 73 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
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:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 41 | private function apiKeyNode(string $name): ArrayNodeDefinition  | 
            ||
| 42 |     { | 
            ||
| 43 | return (new ArrayNodeDefinition($name))  | 
            ||
| 44 | ->canBeEnabled()  | 
            ||
| 45 | ->children()  | 
            ||
| 46 |                 ->append($this->extractorsNode('extractors', [ | 
            ||
| 47 | [  | 
            ||
| 48 | 'type' => 'header',  | 
            ||
| 49 | 'name' => 'Authorization',  | 
            ||
| 50 | 'prefix' => 'Token',  | 
            ||
| 51 | ],  | 
            ||
| 52 | ]))  | 
            ||
| 53 | |||
| 54 |                 ->enumNode('generator') | 
            ||
| 55 | ->values(['fixed', 'random'])  | 
            ||
| 56 |                     ->defaultValue('random') | 
            ||
| 57 | ->end()  | 
            ||
| 58 | |||
| 59 |                 ->arrayNode('storage') | 
            ||
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 60 | ->beforeNormalization()  | 
            ||
| 61 |                         ->ifTrue(function (array $config): bool { | 
            ||
| 62 | return !isset($config[0]);  | 
            ||
| 63 | })  | 
            ||
| 64 |                         ->then(function (array $config): array { | 
            ||
| 65 | return [  | 
            ||
| 66 | ['type' => self::STORAGE_FIXED, 'tokens' => $config],  | 
            ||
| 67 | ];  | 
            ||
| 68 | })  | 
            ||
| 69 | ->end()  | 
            ||
| 70 | ->arrayPrototype()  | 
            ||
| 71 | ->children()  | 
            ||
| 72 |                             ->enumNode('type') | 
            ||
| 73 | ->isRequired()  | 
            ||
| 74 | ->values([self::STORAGE_FIXED, self::STORAGE_REDIS, self::STORAGE_DOCTRINE])  | 
            ||
| 75 | ->end()  | 
            ||
| 76 |                             ->arrayNode('tokens') | 
            ||
| 77 | ->useAttributeAsKey(true)  | 
            ||
| 78 | ->requiresAtLeastOneElement()  | 
            ||
| 79 | ->scalarPrototype()  | 
            ||
| 80 | ->isRequired()  | 
            ||
| 81 | ->end()  | 
            ||
| 82 | ->end()  | 
            ||
| 83 |                             ->booleanNode('writable') | 
            ||
| 84 | ->defaultFalse()  | 
            ||
| 85 | ->end()  | 
            ||
| 86 |                             ->scalarNode('redis_client_id') | 
            ||
| 87 | ->cannotBeEmpty()  | 
            ||
| 88 |                                 ->defaultValue('snc_redis.default') | 
            ||
| 89 | ->end()  | 
            ||
| 90 |                             ->scalarNode('doctrine_connection_id') | 
            ||
| 91 | ->cannotBeEmpty()  | 
            ||
| 92 |                                 ->defaultValue('database_connection') | 
            ||
| 93 | ->end()  | 
            ||
| 94 |                             ->scalarNode('table_name') | 
            ||
| 95 | ->cannotBeEmpty()  | 
            ||
| 96 | ->end()  | 
            ||
| 97 |                             ->arrayNode('fields') | 
            ||
| 98 | ->children()  | 
            ||
| 99 |                                     ->scalarNode('key') | 
            ||
| 100 | ->cannotBeEmpty()  | 
            ||
| 101 | ->end()  | 
            ||
| 102 |                                     ->scalarNode('username') | 
            ||
| 103 | ->cannotBeEmpty()  | 
            ||
| 104 | ->end()  | 
            ||
| 105 |                                     ->scalarNode('expires') | 
            ||
| 106 | ->cannotBeEmpty()  | 
            ||
| 107 | ->end()  | 
            ||
| 108 | ->end()  | 
            ||
| 109 | ->end()  | 
            ||
| 110 | ->end()  | 
            ||
| 111 | ->end()  | 
            ||
| 112 | ->end()  | 
            ||
| 113 | ->end()  | 
            ||
| 114 | ;  | 
            ||
| 299 |