| Conditions | 3 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 45 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 18 | ||
| Bugs | 5 | Features | 1 |
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 |
||
| 45 | public function getConfigTreeBuilder() |
||
| 46 | { |
||
| 47 | $treeBuilder = new TreeBuilder(); |
||
| 48 | $rootNode = $treeBuilder->root($this->alias); |
||
| 49 | |||
| 50 | $this->addJWKSourcesSection($rootNode, $this->jwk_sources); |
||
| 51 | |||
| 52 | $rootNode |
||
| 53 | ->children() |
||
| 54 | ->arrayNode('compression_methods') |
||
| 55 | ->info('A list of enabled compression methods. Supported methods are: "DEF" (recommended), "GZ" and "ZLIB".') |
||
| 56 | ->prototype('scalar') |
||
| 57 | ->end() |
||
| 58 | ->treatNullLike([]) |
||
| 59 | ->end() |
||
| 60 | ->arrayNode('key_sets') |
||
| 61 | ->defaultValue([]) |
||
| 62 | ->useAttributeAsKey('key') |
||
| 63 | ->prototype('array') |
||
| 64 | ->prototype('scalar') |
||
| 65 | ->end() |
||
| 66 | ->end() |
||
| 67 | ->end() |
||
| 68 | ->arrayNode('storage') |
||
| 69 | ->addDefaultsIfNotSet() |
||
| 70 | ->validate() |
||
| 71 | ->ifTrue(function ($value) { |
||
| 72 | return true === $value['enabled'] && null !== $value['class'] && !class_exists($value['class']); |
||
| 73 | }) |
||
| 74 | ->thenInvalid('The class does not exist') |
||
| 75 | ->end() |
||
| 76 | ->children() |
||
| 77 | ->booleanNode('enabled') |
||
| 78 | ->info('If true, the storage is used and "jti" header parameter is added.') |
||
| 79 | ->defaultFalse() |
||
| 80 | ->end() |
||
| 81 | ->scalarNode('manager') |
||
| 82 | ->info('The "jot" manager.') |
||
| 83 | ->defaultValue('jose.jot_manager.default') |
||
| 84 | ->cannotBeEmpty() |
||
| 85 | ->end() |
||
| 86 | ->scalarNode('class') |
||
| 87 | ->info('The "jot" class.') |
||
| 88 | ->defaultNull() |
||
| 89 | ->end() |
||
| 90 | ->end() |
||
| 91 | ->end() |
||
| 92 | ->end(); |
||
| 93 | |||
| 94 | return $treeBuilder; |
||
| 95 | } |
||
| 96 | |||
| 117 |