Conditions | 1 |
Paths | 1 |
Total Lines | 64 |
Code Lines | 59 |
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 |
||
32 | public function getConfigTreeBuilder() |
||
33 | { |
||
34 | $treeBuilder = new TreeBuilder(); |
||
35 | $rootNode = $treeBuilder->root('sonata_doctrine_phpcr_admin', 'array'); |
||
36 | |||
37 | $rootNode |
||
38 | ->fixXmlConfig('template') |
||
39 | ->children() |
||
40 | ->arrayNode('templates') |
||
41 | ->addDefaultsIfNotSet() |
||
42 | ->children() |
||
43 | ->arrayNode('form') |
||
44 | ->prototype('scalar')->end() |
||
45 | ->defaultValue(array('SonataDoctrinePHPCRAdminBundle:Form:form_admin_fields.html.twig')) |
||
46 | ->end() |
||
47 | ->arrayNode('filter') |
||
48 | ->prototype('scalar')->end() |
||
49 | ->defaultValue(array('SonataDoctrinePHPCRAdminBundle:Form:filter_admin_fields.html.twig')) |
||
50 | ->end() |
||
51 | ->arrayNode('types') |
||
52 | ->children() |
||
53 | ->arrayNode('list') |
||
54 | ->useAttributeAsKey('name') |
||
55 | ->prototype('scalar')->end() |
||
56 | ->end() |
||
57 | ->arrayNode('show') |
||
58 | ->useAttributeAsKey('name') |
||
59 | ->prototype('scalar')->end() |
||
60 | ->end() |
||
61 | ->end() |
||
62 | ->end() |
||
63 | ->scalarNode('pager_results')->defaultValue('SonataDoctrinePHPCRAdminBundle:Pager:simple_pager_results.html.twig')->cannotBeEmpty()->end() |
||
64 | ->end() |
||
65 | ->end() |
||
66 | ->arrayNode('document_tree') |
||
67 | ->canBeEnabled() |
||
68 | ->children() |
||
69 | ->scalarNode('repository_name') |
||
70 | ->defaultValue('default') |
||
71 | ->info('The repository name the resource API connects to.') |
||
72 | ->end() |
||
73 | ->arrayNode('routing_defaults') |
||
74 | ->prototype('scalar')->end() |
||
75 | ->end() |
||
76 | ->scalarNode('sortable_by') |
||
77 | ->defaultValue('position') |
||
78 | ->info('Defines the document property siblings are sorted.') |
||
79 | ->end() |
||
80 | ->arrayNode('move') |
||
81 | ->canBeEnabled() |
||
82 | ->children() |
||
83 | ->booleanNode('reorder') |
||
84 | ->defaultTrue() |
||
85 | ->info('Ordering after a move action is enabled, causes new requests.') |
||
86 | ->end() |
||
87 | ->end() |
||
88 | ->end() |
||
89 | ->end() |
||
90 | ->end() |
||
91 | ->end() |
||
92 | ; |
||
93 | |||
94 | return $treeBuilder; |
||
95 | } |
||
96 | } |
||
97 |