| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 50 |
| 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 |
||
| 63 | public function getNodeDefinition(NodeDefinition $node) |
||
| 64 | { |
||
| 65 | $node->children() |
||
| 66 | ->arrayNode($this->name()) |
||
| 67 | ->addDefaultsIfNotSet() |
||
| 68 | ->children() |
||
| 69 | ->arrayNode('authorization_code') |
||
| 70 | ->validate() |
||
| 71 | ->ifTrue(function ($config) { |
||
| 72 | return $config['max_length'] < $config['min_length']; |
||
| 73 | }) |
||
| 74 | ->thenInvalid('The option "max_length" must be greater than "min_length".') |
||
| 75 | ->end() |
||
| 76 | ->canBeEnabled() |
||
| 77 | ->children() |
||
| 78 | ->integerNode('min_length') |
||
| 79 | ->defaultValue(50) |
||
| 80 | ->min(0) |
||
| 81 | ->info('Minimum length of the randomly generated authorization code') |
||
| 82 | ->end() |
||
| 83 | ->integerNode('max_length') |
||
| 84 | ->defaultValue(100) |
||
| 85 | ->min(1) |
||
| 86 | ->info('Maximum length of the randomly generated authorization code') |
||
| 87 | ->end() |
||
| 88 | ->integerNode('lifetime') |
||
| 89 | ->defaultValue(30) |
||
| 90 | ->min(1) |
||
| 91 | ->info('Authorization code lifetime (in seconds)') |
||
| 92 | ->end() |
||
| 93 | ->scalarNode('repository') |
||
| 94 | ->isRequired() |
||
| 95 | ->info('The authorization code repository') |
||
| 96 | ->end() |
||
| 97 | ->booleanNode('enforce_pkce') |
||
| 98 | ->defaultFalse() |
||
| 99 | ->info('If true, the PKCE is required for all requests including the ones from confidential clients') |
||
| 100 | ->end() |
||
| 101 | ->end() |
||
| 102 | ->end() |
||
| 103 | ->arrayNode('client_credentials') |
||
| 104 | ->canBeEnabled() |
||
| 105 | ->children() |
||
| 106 | ->booleanNode('issue_refresh_token') |
||
| 107 | ->info('If enabled, a refresh token will be issued with an access token (not recommended)') |
||
| 108 | ->defaultFalse() |
||
| 109 | ->end() |
||
| 110 | ->end() |
||
| 111 | ->end() |
||
| 112 | ->end() |
||
| 113 | ->end() |
||
| 114 | ->end(); |
||
| 115 | } |
||
| 116 | |||
| 126 |