Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 47 |
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 |
||
19 | public function getConfigTreeBuilder() |
||
20 | { |
||
21 | $treeBuilder = new TreeBuilder(); |
||
22 | $rootNode = $treeBuilder->root('partnermarketing_file_system'); |
||
23 | |||
24 | $rootNode |
||
25 | ->children() |
||
26 | ->scalarNode('default_file_system') |
||
27 | ->isRequired() |
||
28 | ->end() |
||
29 | ->scalarNode('tmp_dir') |
||
30 | ->defaultValue('/tmp') |
||
31 | ->end() |
||
32 | ->arrayNode('config') |
||
33 | ->addDefaultsIfNotSet() |
||
34 | ->children() |
||
35 | ->arrayNode('amazon_s3') |
||
36 | ->children() |
||
37 | ->scalarNode('key') |
||
38 | ->defaultValue('~') |
||
39 | ->end() |
||
40 | ->scalarNode('secret') |
||
41 | ->defaultValue('~') |
||
42 | ->end() |
||
43 | ->scalarNode('bucket') |
||
44 | ->defaultValue('~') |
||
45 | ->end() |
||
46 | ->scalarNode('region') |
||
47 | ->defaultValue('~') |
||
48 | ->end() |
||
49 | ->scalarNode('acl') |
||
50 | ->defaultValue('public-read') |
||
51 | ->end() |
||
52 | ->end() |
||
53 | ->end() |
||
54 | ->arrayNode('local_storage') |
||
55 | ->children() |
||
56 | ->scalarNode('path') |
||
57 | ->isRequired() |
||
58 | ->end() |
||
59 | ->scalarNode('url') |
||
60 | ->isRequired() |
||
61 | ->end() |
||
62 | ->end() |
||
63 | ->end() |
||
64 | ->end() |
||
65 | ->end() |
||
66 | ->end(); |
||
67 | |||
68 | return $treeBuilder; |
||
69 | } |
||
70 | } |
||
71 |