| Conditions | 1 |
| Paths | 1 |
| Total Lines | 65 |
| Code Lines | 60 |
| 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 |
||
| 12 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 13 | { |
||
| 14 | $treeBuilder = new TreeBuilder('atlassian_connect'); |
||
| 15 | $rootNode = $treeBuilder->getRootNode(); |
||
| 16 | |||
| 17 | $rootNode |
||
| 18 | ->children() |
||
| 19 | ->variableNode('dev_tenant')->defaultValue(1)->end() |
||
| 20 | ->arrayNode('descriptor') |
||
| 21 | ->ignoreExtraKeys() |
||
| 22 | ->children() |
||
| 23 | ->arrayNode('authentication') |
||
| 24 | ->addDefaultsIfNotSet() |
||
| 25 | ->children() |
||
| 26 | ->enumNode('type')->values(['jwt', 'none', 'JWT', 'NONE'])->defaultValue('jwt')->isRequired()->end() |
||
| 27 | ->end() |
||
| 28 | ->end() |
||
| 29 | ->scalarNode('baseUrl')->isRequired()->cannotBeEmpty()->end() |
||
| 30 | ->scalarNode('key')->isRequired()->cannotBeEmpty()->end() |
||
| 31 | ->integerNode('apiVersion')->end() |
||
| 32 | ->scalarNode('name')->end() |
||
| 33 | ->scalarNode('description')->end() |
||
| 34 | ->booleanNode('enableLicensing')->end() |
||
| 35 | ->arrayNode('lifecycle') |
||
| 36 | ->children() |
||
| 37 | ->scalarNode('installed')->end() |
||
| 38 | ->scalarNode('enabled')->end() |
||
| 39 | ->scalarNode('disabled')->end() |
||
| 40 | ->scalarNode('uninstalled')->end() |
||
| 41 | ->end() |
||
| 42 | ->end() |
||
| 43 | ->arrayNode('vendor') |
||
| 44 | ->children() |
||
| 45 | ->scalarNode('name')->end() |
||
| 46 | ->scalarNode('url')->end() |
||
| 47 | ->end() |
||
| 48 | ->end() |
||
| 49 | ->arrayNode('scopes') |
||
| 50 | ->scalarPrototype()->end() |
||
| 51 | ->end() |
||
| 52 | ->variableNode('links') |
||
| 53 | ->end() |
||
| 54 | ->variableNode('modules') |
||
| 55 | ->end() |
||
| 56 | ->arrayNode('translations') |
||
| 57 | ->children() |
||
| 58 | ->arrayNode('paths') |
||
| 59 | ->scalarPrototype()->end() |
||
| 60 | ->end() |
||
| 61 | ->end() |
||
| 62 | ->end() |
||
| 63 | ->end() |
||
| 64 | ->end() |
||
| 65 | ->arrayNode('license_allow_list') |
||
| 66 | ->arrayPrototype() |
||
| 67 | ->children() |
||
| 68 | ->scalarNode('client_key')->end() |
||
| 69 | ->scalarNode('valid_till')->end() |
||
| 70 | ->end() |
||
| 71 | ->end() |
||
| 72 | ->end() |
||
| 73 | ->end() |
||
| 74 | ; |
||
| 75 | |||
| 76 | return $treeBuilder; |
||
| 77 | } |
||
| 79 |