| Conditions | 1 |
| Paths | 1 |
| Total Lines | 59 |
| Code Lines | 54 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 54 |
| CRAP Score | 1 |
| 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 |
||
| 18 | 4 | public function getConfigTreeBuilder() |
|
| 19 | { |
||
| 20 | 4 | $treeBuilder = new TreeBuilder(); |
|
| 21 | 4 | $rootNode = $treeBuilder->root('procergs_nfg'); |
|
| 22 | |||
| 23 | $rootNode |
||
| 24 | 4 | ->children() |
|
| 25 | 4 | ->booleanNode('verify_https') |
|
| 26 | 4 | ->info('When false, errors such as invalid TLS certificates will be ignored') |
|
| 27 | 4 | ->defaultTrue() |
|
| 28 | 4 | ->end() |
|
| 29 | 4 | ->arrayNode('circuit_breaker') |
|
| 30 | 4 | ->addDefaultsIfNotSet() |
|
| 31 | 4 | ->children() |
|
| 32 | 4 | ->integerNode('max_failures') |
|
| 33 | 4 | ->min(1) |
|
| 34 | 4 | ->defaultValue(2) |
|
| 35 | 4 | ->end() |
|
| 36 | 4 | ->integerNode('reset_timeout') |
|
| 37 | 4 | ->min(1) |
|
| 38 | 4 | ->defaultValue(30) |
|
| 39 | 4 | ->end() |
|
| 40 | 4 | ->end() |
|
| 41 | 4 | ->end() |
|
| 42 | 4 | ->arrayNode('endpoints') |
|
| 43 | 4 | ->isRequired() |
|
| 44 | 4 | ->children() |
|
| 45 | 4 | ->scalarNode('wsdl') |
|
| 46 | 4 | ->isRequired() |
|
| 47 | 4 | ->end() |
|
| 48 | 4 | ->scalarNode('login') |
|
| 49 | 4 | ->isRequired() |
|
| 50 | 4 | ->end() |
|
| 51 | 4 | ->scalarNode('authorization') |
|
| 52 | 4 | ->isRequired() |
|
| 53 | 4 | ->end() |
|
| 54 | 4 | ->end() |
|
| 55 | 4 | ->end() |
|
| 56 | 4 | ->arrayNode('authentication') |
|
| 57 | 4 | ->isRequired() |
|
| 58 | 4 | ->children() |
|
| 59 | 4 | ->scalarNode('organization') |
|
| 60 | 4 | ->isRequired() |
|
| 61 | 4 | ->end() |
|
| 62 | 4 | ->scalarNode('username') |
|
| 63 | 4 | ->isRequired() |
|
| 64 | 4 | ->end() |
|
| 65 | 4 | ->scalarNode('password') |
|
| 66 | 4 | ->isRequired() |
|
| 67 | 4 | ->end() |
|
| 68 | 4 | ->scalarNode('hmac_secret') |
|
| 69 | 4 | ->isRequired() |
|
| 70 | 4 | ->end() |
|
| 71 | 4 | ->end() |
|
| 72 | 4 | ->end() |
|
| 73 | 4 | ->end() |
|
| 74 | ; |
||
| 75 | |||
| 76 | 4 | return $treeBuilder; |
|
| 77 | } |
||
| 79 |