| Conditions | 1 |
| Paths | 1 |
| Total Lines | 69 |
| Code Lines | 64 |
| 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 |
||
| 21 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 22 | { |
||
| 23 | $treeBuilder = new TreeBuilder('core'); |
||
| 24 | |||
| 25 | $treeBuilder->getRootNode() |
||
| 26 | ->children() |
||
| 27 | ->scalarNode('datadir') |
||
| 28 | ->info('Directory for data files which might be added or uploaded.') |
||
| 29 | ->defaultValue('public/uploads') |
||
| 30 | ->end() |
||
| 31 | ->enumNode('x_frame_options') |
||
|
|
|||
| 32 | ->info('X-Frame-Options value.') |
||
| 33 | ->values(['SAMEORIGIN', 'DENY']) |
||
| 34 | ->defaultValue('SAMEORIGIN') |
||
| 35 | ->end() |
||
| 36 | ->arrayNode('maintenance_mode') |
||
| 37 | ->info('Disable site for maintenance.') |
||
| 38 | ->canBeEnabled() |
||
| 39 | ->children() |
||
| 40 | ->scalarNode('reason') |
||
| 41 | ->info('Reason for disabling site.') |
||
| 42 | ->defaultNull() |
||
| 43 | ->end() |
||
| 44 | ->end() |
||
| 45 | ->end() |
||
| 46 | ->booleanNode('enable_mail_logging') |
||
| 47 | ->info('Whether mail logging should be used or not.') |
||
| 48 | ->defaultFalse() |
||
| 49 | ->end() |
||
| 50 | ->booleanNode('multilingual') |
||
| 51 | ->info('Activate multilingual features.') |
||
| 52 | ->defaultTrue() |
||
| 53 | ->end() |
||
| 54 | ->arrayNode('site_data') |
||
| 55 | ->info('Main site information (if desired per locale).') |
||
| 56 | ->useAttributeAsKey('locale') |
||
| 57 | ->arrayPrototype() |
||
| 58 | ->children() |
||
| 59 | ->scalarNode('locale') |
||
| 60 | ->info('Locale code.') |
||
| 61 | ->defaultValue('en') |
||
| 62 | ->end() |
||
| 63 | ->scalarNode('sitename') |
||
| 64 | ->info('Site name.') |
||
| 65 | ->defaultValue('My site') |
||
| 66 | ->end() |
||
| 67 | ->scalarNode('slogan') |
||
| 68 | ->info('Site description.') |
||
| 69 | ->defaultValue('This is my site.') |
||
| 70 | ->end() |
||
| 71 | ->scalarNode('page_title_scheme') |
||
| 72 | ->info('Page title scheme. Possible tags: #pagetitle#, #sitename#.') |
||
| 73 | ->defaultValue('#pagetitle# - #sitename#') |
||
| 74 | ->end() |
||
| 75 | ->scalarNode('meta_description') |
||
| 76 | ->info('Meta description.') |
||
| 77 | ->defaultValue('This is my site description.') |
||
| 78 | ->end() |
||
| 79 | ->scalarNode('admin_mail') |
||
| 80 | ->info('Admin mail address.') |
||
| 81 | ->defaultNull() |
||
| 82 | ->end() |
||
| 83 | ->end() |
||
| 84 | ->end() |
||
| 85 | ->end() |
||
| 86 | ->end() |
||
| 87 | ; |
||
| 88 | |||
| 89 | return $treeBuilder; |
||
| 90 | } |
||
| 92 |