| Conditions | 4 |
| Paths | 1 |
| Total Lines | 106 |
| Code Lines | 101 |
| 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 |
||
| 67 | public function getNodeDefinition(NodeDefinition $node) |
||
| 68 | { |
||
| 69 | $node->children() |
||
| 70 | ->arrayNode($this->name()) |
||
| 71 | ->addDefaultsIfNotSet() |
||
| 72 | ->children() |
||
| 73 | ->arrayNode('none') |
||
| 74 | ->info('The "none" authentication method is designed for public clients') |
||
| 75 | ->canBeEnabled() |
||
| 76 | ->end() |
||
| 77 | ->arrayNode('client_secret_basic') |
||
| 78 | ->canBeEnabled() |
||
| 79 | ->children() |
||
| 80 | ->scalarNode('realm') |
||
| 81 | ->isRequired() |
||
| 82 | ->info('The realm displayed in the authentication header') |
||
| 83 | ->end() |
||
| 84 | ->integerNode('secret_lifetime') |
||
| 85 | ->defaultValue(60 * 60 * 24 * 14) |
||
| 86 | ->min(0) |
||
| 87 | ->info('Secret lifetime (in seconds; 0 = unlimited)') |
||
| 88 | ->end() |
||
| 89 | ->end() |
||
| 90 | ->end() |
||
| 91 | ->arrayNode('client_secret_post') |
||
| 92 | ->canBeEnabled() |
||
| 93 | ->children() |
||
| 94 | ->integerNode('secret_lifetime') |
||
| 95 | ->defaultValue(60 * 60 * 24 * 14) |
||
| 96 | ->min(0) |
||
| 97 | ->info('Secret lifetime (in seconds; 0 = unlimited)') |
||
| 98 | ->end() |
||
| 99 | ->end() |
||
| 100 | ->end() |
||
| 101 | ->arrayNode('client_assertion_jwt') |
||
| 102 | ->canBeEnabled() |
||
| 103 | ->info('This method comprises the "client_secret_jwt" and the "private_key_jwt" authentication methods') |
||
| 104 | ->validate() |
||
| 105 | ->ifTrue(function ($config) { |
||
| 106 | return true === $config['enabled'] && empty($config['signature_algorithms']); |
||
| 107 | }) |
||
| 108 | ->thenInvalid('At least one signature algorithm must be set.') |
||
| 109 | ->end() |
||
| 110 | ->children() |
||
| 111 | ->integerNode('secret_lifetime') |
||
| 112 | ->info('Secret lifetime (in seconds; 0 = unlimited) applicable to the "client_secret_jwt" authentication method') |
||
| 113 | ->defaultValue(60 * 60 * 24 * 14) |
||
| 114 | ->min(0) |
||
| 115 | ->end() |
||
| 116 | ->arrayNode('signature_algorithms') |
||
| 117 | ->info('Supported signature algorithms.') |
||
| 118 | ->useAttributeAsKey('name') |
||
| 119 | ->prototype('scalar')->end() |
||
| 120 | ->treatNullLike([]) |
||
| 121 | ->end() |
||
| 122 | ->arrayNode('claim_checkers') |
||
| 123 | ->info('Claim checkers for incoming assertions.') |
||
| 124 | ->useAttributeAsKey('name') |
||
| 125 | ->prototype('scalar')->end() |
||
| 126 | ->treatNullLike([]) |
||
| 127 | ->end() |
||
| 128 | ->arrayNode('header_checkers') |
||
| 129 | ->info('Header checkers for incoming assertions.') |
||
| 130 | ->useAttributeAsKey('name') |
||
| 131 | ->prototype('scalar')->end() |
||
| 132 | ->treatNullLike([]) |
||
| 133 | ->end() |
||
| 134 | ->arrayNode('encryption') |
||
| 135 | ->canBeEnabled() |
||
| 136 | ->validate() |
||
| 137 | ->ifTrue(function ($config) { |
||
| 138 | return true === $config['enabled'] && empty($config['key_encryption_algorithms']); |
||
| 139 | }) |
||
| 140 | ->thenInvalid('At least one key encryption algorithm must be set.') |
||
| 141 | ->end() |
||
| 142 | ->validate() |
||
| 143 | ->ifTrue(function ($config) { |
||
| 144 | return true === $config['enabled'] && empty($config['content_encryption_algorithms']); |
||
| 145 | }) |
||
| 146 | ->thenInvalid('At least one content encryption algorithm must be set.') |
||
| 147 | ->end() |
||
| 148 | ->children() |
||
| 149 | ->booleanNode('required') |
||
| 150 | ->info('When true, all incoming assertions must be encrypted.') |
||
| 151 | ->defaultFalse() |
||
| 152 | ->end() |
||
| 153 | ->arrayNode('key_encryption_algorithms') |
||
| 154 | ->info('Supported key encryption algorithms.') |
||
| 155 | ->useAttributeAsKey('name') |
||
| 156 | ->prototype('scalar')->end() |
||
| 157 | ->treatNullLike([]) |
||
| 158 | ->end() |
||
| 159 | ->arrayNode('content_encryption_algorithms') |
||
| 160 | ->info('Supported content encryption algorithms.') |
||
| 161 | ->useAttributeAsKey('name') |
||
| 162 | ->prototype('scalar')->end() |
||
| 163 | ->treatNullLike([]) |
||
| 164 | ->end() |
||
| 165 | ->end() |
||
| 166 | ->end() |
||
| 167 | ->end() |
||
| 168 | ->end() |
||
| 169 | ->end() |
||
| 170 | ->end() |
||
| 171 | ->end(); |
||
| 172 | } |
||
| 173 | |||
| 183 |