Conditions | 1 |
Paths | 1 |
Total Lines | 80 |
Code Lines | 75 |
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 |
||
29 | public function getConfigTreeBuilder() |
||
30 | { |
||
31 | $treeBuilder = new TreeBuilder(); |
||
32 | $rootNode = $treeBuilder->root('veslo_anthill'); |
||
33 | |||
34 | $rootNode |
||
35 | ->children() |
||
36 | ->arrayNode('vacancy') |
||
37 | ->children() |
||
38 | ->arrayNode('digging') |
||
39 | ->children() |
||
40 | ->arrayNode('roadmap') |
||
41 | ->children() |
||
42 | ->integerNode('attempts_until_pause') |
||
43 | ->info('How much vacancy search attempts cranky dung beetle should perform via roadmap before give up') |
||
44 | ->isRequired() |
||
45 | ->min(1) |
||
46 | ->end() |
||
47 | ->integerNode('pause_duration') |
||
48 | ->info('Give up time in seconds for cranky dung beetle after too much unsuccessful vacancy search attempts') |
||
49 | ->isRequired() |
||
50 | ->min(10) |
||
51 | ->end() |
||
52 | ->end() |
||
53 | ->end() |
||
54 | ->end() |
||
55 | ->end() |
||
56 | ->arrayNode('provider') |
||
57 | ->info('Options for vacancy providers') |
||
58 | ->children() |
||
59 | ->arrayNode('journal') |
||
60 | ->children() |
||
61 | ->integerNode('per_page') |
||
62 | ->info('Vacancies count per page for rendering during list action') |
||
63 | ->isRequired() |
||
64 | ->min(1) |
||
65 | ->end() |
||
66 | ->integerNode('max_days_after_publication') |
||
67 | ->info('How many days after publication are allowed for a vacancy to be rendered in "fresh" lists') |
||
68 | ->isRequired() |
||
69 | ->min(1) |
||
70 | ->end() |
||
71 | ->end() |
||
72 | ->end() |
||
73 | ->arrayNode('archive') |
||
74 | ->children() |
||
75 | ->integerNode('per_page') |
||
76 | ->isRequired() |
||
77 | ->min(1) |
||
78 | ->end() |
||
79 | ->integerNode('min_days_after_publication') |
||
80 | ->info('Minimum days after publication that is required for a vacancy to be considered as "archived"') |
||
81 | ->isRequired() |
||
82 | ->min(1) |
||
83 | ->end() |
||
84 | ->end() |
||
85 | ->end() |
||
86 | ->end() |
||
87 | ->end() |
||
88 | ->arrayNode('repository') |
||
89 | ->info('Options for vacancy repository') |
||
90 | ->children() |
||
91 | ->scalarNode('cache_result_namespace') |
||
92 | ->info('Query result cache namespace for vacancy repository') |
||
93 | ->isRequired() |
||
94 | ->cannotBeEmpty() |
||
95 | ->end() |
||
96 | ->integerNode('cache_result_lifetime') |
||
97 | ->info('How long query result cache will be available after successful put; during this time some data changes on website will not be seen, for example, vacancy list') |
||
98 | ->isRequired() |
||
99 | ->min(0) |
||
100 | ->end() |
||
101 | ->end() |
||
102 | ->end() |
||
103 | ->end() |
||
104 | ->end() |
||
105 | ->end() |
||
106 | ; |
||
107 | |||
108 | return $treeBuilder; |
||
109 | } |
||
111 |