| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 63 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 32 | public function getConfigTreeBuilder() |
||
| 33 | { |
||
| 34 | $treeBuilder = new TreeBuilder(); |
||
| 35 | $treeBuilder->root('swp_multi_tenancy') |
||
| 36 | ->children() |
||
| 37 | ->arrayNode('resources') |
||
| 38 | ->addDefaultsIfNotSet() |
||
| 39 | ->children() |
||
| 40 | ->arrayNode('tenant') |
||
| 41 | ->addDefaultsIfNotSet() |
||
| 42 | ->children() |
||
| 43 | ->arrayNode('classes') |
||
| 44 | ->addDefaultsIfNotSet() |
||
| 45 | ->children() |
||
| 46 | ->scalarNode('model') |
||
| 47 | ->defaultValue(Tenant::class) |
||
| 48 | ->cannotBeEmpty() |
||
| 49 | ->info('The FQCN of the Tenant model class.') |
||
| 50 | ->end() |
||
| 51 | ->scalarNode('factory') |
||
| 52 | ->defaultValue(TenantFactory::class) |
||
| 53 | ->info('The FQCN of the Tenant Factory class.') |
||
| 54 | ->end() |
||
| 55 | ->end() |
||
| 56 | ->end() |
||
| 57 | ->end() |
||
| 58 | ->end() |
||
| 59 | ->end() |
||
| 60 | ->end() |
||
| 61 | ->arrayNode('persistence') |
||
| 62 | ->addDefaultsIfNotSet() |
||
| 63 | ->children() |
||
| 64 | ->arrayNode('phpcr') |
||
| 65 | ->addDefaultsIfNotSet() |
||
| 66 | ->canBeEnabled() |
||
| 67 | ->children() |
||
| 68 | ->scalarNode('basepath')->defaultValue('/swp')->end() |
||
| 69 | ->arrayNode('route_basepaths') |
||
| 70 | ->prototype('scalar')->end() |
||
| 71 | ->defaultValue(['routes']) |
||
| 72 | ->info('Route base paths names') |
||
| 73 | ->end() |
||
| 74 | ->scalarNode('content_basepath') |
||
| 75 | ->defaultValue('content') |
||
| 76 | ->info('Content base path name') |
||
| 77 | ->end() |
||
| 78 | ->scalarNode('site_document_class') |
||
| 79 | ->defaultValue('SWP\Bundle\MultiTenancyBundle\Document\Site') |
||
| 80 | ->info('Site document class, represents current site/tenant in PHPCR tree') |
||
| 81 | ->end() |
||
| 82 | ->scalarNode('tenant_aware_router_class') |
||
| 83 | ->defaultValue('SWP\Bundle\MultiTenancyBundle\Routing\TenantAwareRouter') |
||
| 84 | ->info('Tenant aware router FQCN') |
||
| 85 | ->end() |
||
| 86 | ->scalarNode('document_class') |
||
| 87 | ->defaultValue('SWP\Bundle\MultiTenancyBundle\Document\Page') |
||
| 88 | ->info('The class for the pages used by PHPCR initializer') |
||
| 89 | ->end() |
||
| 90 | ->end() |
||
| 91 | ->end() |
||
| 92 | ->end() |
||
| 93 | ->end() |
||
| 94 | ->end(); |
||
| 95 | |||
| 96 | return $treeBuilder; |
||
| 97 | } |
||
| 98 | } |
||
| 99 |