| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 45 |
| 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 |
||
| 73 | public function getNodeDefinition(NodeDefinition $node) |
||
| 74 | { |
||
| 75 | |||
| 76 | $node |
||
| 77 | ->validate() |
||
| 78 | ->ifTrue(function ($config) { |
||
| 79 | return empty($config['default_signature_algorithm']); |
||
| 80 | }) |
||
| 81 | ->thenInvalid('The option "default_signature_algorithm" must be set.') |
||
| 82 | ->end() |
||
| 83 | ->validate() |
||
| 84 | ->ifTrue(function ($config) { |
||
| 85 | return empty($config['signature_algorithms']); |
||
| 86 | }) |
||
| 87 | ->thenInvalid('The option "signature_algorithm" must contain at least one signature algorithm.') |
||
| 88 | ->end() |
||
| 89 | ->validate() |
||
| 90 | ->ifTrue(function ($config) { |
||
| 91 | return !in_array($config['default_signature_algorithm'], $config['signature_algorithms']); |
||
| 92 | }) |
||
| 93 | ->thenInvalid('The default signature algorithm must be in the supported signature algorithms.') |
||
| 94 | ->end() |
||
| 95 | ->children() |
||
| 96 | ->scalarNode('default_signature_algorithm') |
||
| 97 | ->info('Signature algorithm used if the client has not defined a preferred one. Recommended value is "RS256".') |
||
| 98 | ->end() |
||
| 99 | ->arrayNode('signature_algorithms') |
||
| 100 | ->info('Signature algorithm used to sign the ID Tokens.') |
||
| 101 | ->useAttributeAsKey('name') |
||
| 102 | ->prototype('scalar')->end() |
||
| 103 | ->treatNullLike([]) |
||
| 104 | ->end() |
||
| 105 | ->arrayNode('claim_checkers') |
||
| 106 | ->info('Checkers will verify the JWT claims.') |
||
| 107 | ->useAttributeAsKey('name') |
||
| 108 | ->prototype('scalar')->end() |
||
| 109 | ->treatNullLike(['exp', 'iat', 'nbf']) |
||
| 110 | ->end() |
||
| 111 | ->arrayNode('header_checkers') |
||
| 112 | ->info('Checkers will verify the JWT headers.') |
||
| 113 | ->useAttributeAsKey('name') |
||
| 114 | ->prototype('scalar')->end() |
||
| 115 | ->treatNullLike(['crit']) |
||
| 116 | ->end() |
||
| 117 | ->integerNode('lifetime') |
||
| 118 | ->info('Lifetime of the ID Tokens (in seconds). If an access token is issued with the ID Token, the lifetime of the access token is used instead of this value.') |
||
| 119 | ->defaultValue(3600) |
||
| 120 | ->min(1) |
||
| 121 | ->end() |
||
| 122 | ->end(); |
||
| 123 | } |
||
| 124 | } |
||
| 125 |