| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 56 | 
| Code Lines | 51 | 
| 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 | ->children() | ||
| 42 |                         ->arrayNode('form') | ||
| 43 |                             ->prototype('scalar')->end() | ||
| 44 |                             ->defaultValue(array('SonataDoctrinePHPCRAdminBundle:Form:form_admin_fields.html.twig')) | ||
| 45 | ->end() | ||
| 46 |                         ->arrayNode('filter') | ||
| 47 |                             ->prototype('scalar')->end() | ||
| 48 |                             ->defaultValue(array('SonataDoctrinePHPCRAdminBundle:Form:filter_admin_fields.html.twig')) | ||
| 49 | ->end() | ||
| 50 |                         ->arrayNode('types') | ||
| 51 | ->children() | ||
| 52 |                                 ->arrayNode('list') | ||
| 53 |                                     ->useAttributeAsKey('name') | ||
| 54 |                                     ->prototype('scalar')->end() | ||
| 55 | ->end() | ||
| 56 |                                 ->arrayNode('show') | ||
| 57 |                                     ->useAttributeAsKey('name') | ||
| 58 |                                     ->prototype('scalar')->end() | ||
| 59 | ->end() | ||
| 60 | ->end() | ||
| 61 | ->end() | ||
| 62 |                         ->scalarNode('pager_results')->defaultValue('SonataDoctrinePHPCRAdminBundle:Pager:simple_pager_results.html.twig')->cannotBeEmpty()->end() | ||
| 63 | ->end() | ||
| 64 | ->end() | ||
| 65 |                 ->arrayNode('document_tree') | ||
| 66 | ->addDefaultsIfNotSet() | ||
| 67 | ->canBeEnabled() | ||
| 68 | ->children() | ||
| 69 |                         ->scalarNode('repository_name') | ||
| 70 | ->defaultNull() | ||
| 71 |                             ->info('The repository name the resource API connects to.') | ||
| 72 | ->end() | ||
| 73 |                         ->arrayNode('routing_defaults') | ||
| 74 |                             ->prototype('scalar')->end() | ||
| 75 |                             ->info('Routing defaults passed to the resources API call.') | ||
| 76 | ->end() | ||
| 77 |                         ->scalarNode('sortable_by') | ||
| 78 |                             ->defaultValue('position') | ||
| 79 |                             ->info('Defines by which property to sort sibling documents.') | ||
| 80 | ->end() | ||
| 81 | ->end() | ||
| 82 | ->end() | ||
| 83 | ->end() | ||
| 84 | ; | ||
| 85 | |||
| 86 | return $treeBuilder; | ||
| 87 | } | ||
| 88 | } | ||
| 89 |