| Conditions | 1 |
| Paths | 1 |
| Total Lines | 77 |
| Code Lines | 72 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 21 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 22 | { |
||
| 23 | $treeBuilder = new TreeBuilder('zikula_legal'); |
||
| 24 | |||
| 25 | $treeBuilder->getRootNode() |
||
| 26 | ->fixXmlConfig('policy') |
||
|
|
|||
| 27 | ->children() |
||
| 28 | ->arrayNode('policies') |
||
| 29 | ->info('Configure the available policies.') |
||
| 30 | ->addDefaultsIfNotSet() |
||
| 31 | ->children() |
||
| 32 | ->arrayNode('legal_notice') |
||
| 33 | ->info('Legal notice.') |
||
| 34 | ->canBeDisabled() |
||
| 35 | ->children() |
||
| 36 | ->scalarNode('custom_url') |
||
| 37 | ->defaultNull() |
||
| 38 | ->end() |
||
| 39 | ->end() |
||
| 40 | ->end() |
||
| 41 | ->arrayNode('privacy_policy') |
||
| 42 | ->info('Privacy policy.') |
||
| 43 | ->canBeDisabled() |
||
| 44 | ->children() |
||
| 45 | ->scalarNode('custom_url') |
||
| 46 | ->defaultNull() |
||
| 47 | ->end() |
||
| 48 | ->end() |
||
| 49 | ->end() |
||
| 50 | ->arrayNode('terms_of_use') |
||
| 51 | ->info('Terms of use.') |
||
| 52 | ->canBeEnabled() |
||
| 53 | ->children() |
||
| 54 | ->scalarNode('custom_url') |
||
| 55 | ->defaultNull() |
||
| 56 | ->end() |
||
| 57 | ->end() |
||
| 58 | ->end() |
||
| 59 | ->arrayNode('trade_conditions') |
||
| 60 | ->info('General terms and conditions of trade.') |
||
| 61 | ->canBeEnabled() |
||
| 62 | ->children() |
||
| 63 | ->scalarNode('custom_url') |
||
| 64 | ->defaultNull() |
||
| 65 | ->end() |
||
| 66 | ->end() |
||
| 67 | ->end() |
||
| 68 | ->arrayNode('cancellation_right_policy') |
||
| 69 | ->info('Cancellation right policy.') |
||
| 70 | ->canBeEnabled() |
||
| 71 | ->children() |
||
| 72 | ->scalarNode('custom_url') |
||
| 73 | ->defaultNull() |
||
| 74 | ->end() |
||
| 75 | ->end() |
||
| 76 | ->end() |
||
| 77 | ->arrayNode('accessibility') |
||
| 78 | ->info('Accessibility statement.') |
||
| 79 | ->canBeEnabled() |
||
| 80 | ->children() |
||
| 81 | ->scalarNode('custom_url') |
||
| 82 | ->defaultNull() |
||
| 83 | ->end() |
||
| 84 | ->end() |
||
| 85 | ->end() |
||
| 86 | ->end() |
||
| 87 | ->end() |
||
| 88 | ->integerNode('minimum_age') |
||
| 89 | ->info('Minimum age permitted to register (0 disables the age check).') |
||
| 90 | ->defaultValue(13) |
||
| 91 | ->min(0) |
||
| 92 | ->max(99) |
||
| 93 | ->end() |
||
| 94 | ->end() |
||
| 95 | ; |
||
| 96 | |||
| 97 | return $treeBuilder; |
||
| 98 | } |
||
| 100 |