Conditions | 1 |
Paths | 1 |
Total Lines | 65 |
Code Lines | 61 |
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 |
||
15 | public function getConfigTreeBuilder() |
||
16 | { |
||
17 | $treeBuilder = new TreeBuilder(); |
||
18 | $rootNode = $treeBuilder->root('dtc_grid'); |
||
19 | |||
20 | $rootNode |
||
21 | ->children() |
||
22 | ->arrayNode('jq_grid') |
||
23 | ->children() |
||
24 | ->arrayNode('css') |
||
25 | ->prototype('scalar')->end() |
||
26 | ->end() |
||
27 | ->arrayNode('js') |
||
28 | ->prototype('scalar')->end() |
||
29 | ->end() |
||
30 | ->end() |
||
31 | ->end() |
||
32 | ->scalarNode('purl') |
||
33 | ->defaultValue('https://cdnjs.cloudflare.com/ajax/libs/purl/2.3.1/purl.min.js') |
||
34 | ->end() |
||
35 | ->arrayNode('jquery') |
||
36 | ->addDefaultsIfNotSet() |
||
37 | ->children() |
||
38 | ->scalarNode('url') |
||
39 | ->defaultValue('https://code.jquery.com/jquery-3.2.1.min.js') |
||
40 | ->end() |
||
41 | ->scalarNode('integrity') |
||
42 | ->defaultValue('sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=') |
||
43 | ->end() |
||
44 | ->scalarNode('crossorigin') |
||
45 | ->defaultValue('anonymous') |
||
46 | ->end() |
||
47 | ->end() |
||
48 | ->end() |
||
49 | ->arrayNode('datatables') |
||
50 | ->addDefaultsIfNotSet() |
||
51 | ->children() |
||
52 | ->arrayNode('css') |
||
53 | ->prototype('scalar')->end() |
||
54 | ->defaultValue(['https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css']) |
||
55 | ->end() |
||
56 | ->arrayNode('js') |
||
57 | ->prototype('scalar')->end() |
||
58 | ->defaultValue(['https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js', |
||
59 | 'https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js', ]) |
||
60 | ->end() |
||
61 | ->end() |
||
62 | ->end() |
||
63 | ->arrayNode('theme') |
||
64 | ->addDefaultsIfNotSet() |
||
65 | ->children() |
||
66 | ->arrayNode('css') |
||
67 | ->prototype('scalar')->end() |
||
68 | ->defaultValue(['https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css']) |
||
69 | ->end() |
||
70 | ->arrayNode('js') |
||
71 | ->prototype('scalar')->end() |
||
72 | ->defaultValue(['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js']) |
||
73 | ->end() |
||
74 | ->end() |
||
75 | ->end() |
||
76 | ->scalarNode('page_div_style')->defaultValue('margin: 10px')->end() |
||
77 | ->end(); |
||
78 | |||
79 | return $treeBuilder; |
||
80 | } |
||
82 |