| Conditions | 1 |
| Paths | 1 |
| Total Lines | 77 |
| Code Lines | 72 |
| 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 |
||
| 55 | public function getNodeDefinition(ArrayNodeDefinition $node, ArrayNodeDefinition $rootNode) |
||
| 56 | { |
||
| 57 | $node->children() |
||
| 58 | ->arrayNode($this->name()) |
||
| 59 | ->addDefaultsIfNotSet() |
||
| 60 | ->validate() |
||
| 61 | ->ifTrue(function ($config) { |
||
| 62 | return empty($config['default_signature_algorithm']); |
||
| 63 | }) |
||
| 64 | ->thenInvalid('The option "default_signature_algorithm" must be set.') |
||
| 65 | ->end() |
||
| 66 | ->validate() |
||
| 67 | ->ifTrue(function ($config) { |
||
| 68 | return empty($config['signature_algorithms']); |
||
| 69 | }) |
||
| 70 | ->thenInvalid('The option "signature_algorithm" must contain at least one signature algorithm.') |
||
| 71 | ->end() |
||
| 72 | ->validate() |
||
| 73 | ->ifTrue(function ($config) { |
||
| 74 | return !in_array($config['default_signature_algorithm'], $config['signature_algorithms']); |
||
| 75 | }) |
||
| 76 | ->thenInvalid('The default signature algorithm must be in the supported signature algorithms.') |
||
| 77 | ->end() |
||
| 78 | ->children() |
||
| 79 | ->scalarNode('default_signature_algorithm') |
||
| 80 | ->info('Signature algorithm used if the client has not defined a preferred one. Recommended value is "RS256".') |
||
| 81 | ->end() |
||
| 82 | ->arrayNode('signature_algorithms') |
||
| 83 | ->info('Signature algorithm used to sign the ID Tokens.') |
||
| 84 | ->useAttributeAsKey('name') |
||
| 85 | ->scalarPrototype()->end() |
||
| 86 | ->treatNullLike([]) |
||
| 87 | ->treatFalseLike([]) |
||
| 88 | ->end() |
||
| 89 | ->scalarNode('signature_keys') |
||
| 90 | ->info('Signature keys used to sign the ID tokens.') |
||
| 91 | ->end() |
||
| 92 | ->arrayNode('claim_checkers') |
||
| 93 | ->info('Checkers will verify the JWT claims.') |
||
| 94 | ->useAttributeAsKey('name') |
||
| 95 | ->scalarPrototype()->end() |
||
| 96 | ->treatNullLike(['exp', 'iat', 'nbf']) |
||
| 97 | ->end() |
||
| 98 | ->arrayNode('header_checkers') |
||
| 99 | ->info('Checkers will verify the JWT headers.') |
||
| 100 | ->useAttributeAsKey('name') |
||
| 101 | ->scalarPrototype()->end() |
||
| 102 | ->treatNullLike([]) |
||
| 103 | ->treatFalseLike([]) |
||
| 104 | ->end() |
||
| 105 | ->integerNode('lifetime') |
||
| 106 | ->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.') |
||
| 107 | ->defaultValue(3600) |
||
| 108 | ->min(1) |
||
| 109 | ->end() |
||
| 110 | ->arrayNode('encryption') |
||
| 111 | ->canBeEnabled() |
||
| 112 | ->children() |
||
| 113 | ->arrayNode('key_encryption_algorithms') |
||
| 114 | ->info('Supported key encryption algorithms.') |
||
| 115 | ->useAttributeAsKey('name') |
||
| 116 | ->scalarPrototype()->end() |
||
| 117 | ->treatNullLike([]) |
||
| 118 | ->treatFalseLike([]) |
||
| 119 | ->end() |
||
| 120 | ->arrayNode('content_encryption_algorithms') |
||
| 121 | ->info('Supported content encryption algorithms.') |
||
| 122 | ->useAttributeAsKey('name') |
||
| 123 | ->scalarPrototype()->end() |
||
| 124 | ->treatNullLike([]) |
||
| 125 | ->treatFalseLike([]) |
||
| 126 | ->end() |
||
| 127 | ->end() |
||
| 128 | ->end() |
||
| 129 | ->end() |
||
| 130 | ->end(); |
||
| 131 | } |
||
| 132 | |||
| 160 |