Conditions | 1 |
Paths | 1 |
Total Lines | 66 |
Code Lines | 61 |
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 |
||
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 | ->variableNode('regionBaseUrls')->end() |
||
31 | ->scalarNode('key')->isRequired()->cannotBeEmpty()->end() |
||
32 | ->integerNode('apiVersion')->end() |
||
33 | ->scalarNode('name')->end() |
||
34 | ->scalarNode('description')->end() |
||
35 | ->scalarNode('aliasKey')->end() |
||
36 | ->booleanNode('enableLicensing')->end() |
||
37 | ->arrayNode('lifecycle') |
||
38 | ->children() |
||
39 | ->scalarNode('installed')->end() |
||
40 | ->scalarNode('enabled')->end() |
||
41 | ->scalarNode('disabled')->end() |
||
42 | ->scalarNode('uninstalled')->end() |
||
43 | ->end() |
||
44 | ->end() |
||
45 | ->arrayNode('vendor') |
||
46 | ->children() |
||
47 | ->scalarNode('name')->end() |
||
48 | ->scalarNode('url')->end() |
||
49 | ->end() |
||
50 | ->end() |
||
51 | ->arrayNode('scopes') |
||
52 | ->scalarPrototype()->end() |
||
53 | ->end() |
||
54 | ->variableNode('links')->end() |
||
55 | ->variableNode('modules')->end() |
||
56 | ->variableNode('apiMigrations')->end() |
||
57 | ->arrayNode('translations') |
||
58 | ->children() |
||
59 | ->arrayNode('paths') |
||
60 | ->scalarPrototype()->end() |
||
61 | ->end() |
||
62 | ->end() |
||
63 | ->end() |
||
64 | ->end() |
||
65 | ->end() |
||
66 | ->arrayNode('license_allow_list') |
||
67 | ->arrayPrototype() |
||
68 | ->children() |
||
69 | ->scalarNode('client_key')->end() |
||
70 | ->scalarNode('valid_till')->end() |
||
71 | ->end() |
||
72 | ->end() |
||
73 | ->end() |
||
74 | ->end() |
||
75 | ; |
||
76 | |||
77 | return $treeBuilder; |
||
78 | } |
||
80 |