| Conditions | 1 |
| Paths | 1 |
| Total Lines | 130 |
| Code Lines | 125 |
| 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 |
||
| 23 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 24 | { |
||
| 25 | $treeBuilder = new TreeBuilder('zikula_theme'); |
||
| 26 | |||
| 27 | $treeBuilder->getRootNode() |
||
| 28 | ->children() |
||
| 29 | ->arrayNode('user_dashboard') |
||
| 30 | ->info('Dashboard for main site.') |
||
| 31 | ->addDefaultsIfNotSet() |
||
| 32 | ->children() |
||
| 33 | ->scalarNode('class') |
||
| 34 | ->info('FQCN of the dashboard controller used for the user dashboard.') |
||
| 35 | ->defaultValue(UserDashboardController::class) |
||
| 36 | ->end() |
||
| 37 | ->arrayNode('view') |
||
| 38 | ->info('Default view option.') |
||
| 39 | ->addDefaultsIfNotSet() |
||
| 40 | ->children() |
||
| 41 | ->booleanNode('content_maximized') |
||
| 42 | ->info('Whether the page content should span the entire browser width, instead of a defined max width.') |
||
| 43 | ->defaultTrue() |
||
| 44 | ->end() |
||
| 45 | ->booleanNode('sidebar_minimized') |
||
| 46 | ->info('Whether the sidebar (which contains the main menu) should be displayed as a narrow column instead of the expanded design.') |
||
| 47 | ->defaultFalse() |
||
| 48 | ->end() |
||
| 49 | ->end() |
||
| 50 | ->end() |
||
| 51 | ->arrayNode('content') |
||
| 52 | ->info('Index page behavior.') |
||
| 53 | ->addDefaultsIfNotSet() |
||
| 54 | ->children() |
||
| 55 | ->scalarNode('template') |
||
| 56 | ->info('Render a template at the specified path.') |
||
| 57 | ->defaultValue('@ZikulaTheme/welcome.html.twig') |
||
| 58 | ->end() |
||
| 59 | ->arrayNode('redirect') |
||
| 60 | ->info('Redirect to a specific page.') |
||
| 61 | ->addDefaultsIfNotSet() |
||
| 62 | ->children() |
||
| 63 | ->scalarNode('crud') |
||
| 64 | ->info('FQCN of a CRUD controller to use as default.') |
||
| 65 | ->defaultNull() |
||
| 66 | ->end() |
||
| 67 | ->scalarNode('route') |
||
| 68 | ->info('Arbitrary route to use as default.') |
||
| 69 | ->defaultNull() |
||
| 70 | ->end() |
||
| 71 | ->arrayNode('route_parameters') |
||
| 72 | ->info('Array of route parameters (each defined by "name" and "value" entries).') |
||
| 73 | ->useAttributeAsKey('name') |
||
| 74 | ->arrayPrototype() |
||
| 75 | ->children() |
||
| 76 | ->scalarNode('name')->end() |
||
| 77 | ->scalarNode('value')->end() |
||
| 78 | ->end() |
||
| 79 | ->end() |
||
| 80 | ->end() |
||
| 81 | ->end() |
||
| 82 | ->end() |
||
| 83 | ->end() |
||
| 84 | ->end() |
||
| 85 | ->end() |
||
| 86 | ->end() |
||
| 87 | ->arrayNode('admin_dashboard') |
||
| 88 | ->info('Dashboard for admin area.') |
||
| 89 | ->addDefaultsIfNotSet() |
||
| 90 | ->children() |
||
| 91 | ->scalarNode('class') |
||
| 92 | ->info('FQCN of the dashboard controller used for the admin dashboard.') |
||
| 93 | ->defaultValue(AdminDashboardController::class) |
||
| 94 | ->end() |
||
| 95 | ->arrayNode('view') |
||
| 96 | ->info('Default view option.') |
||
| 97 | ->addDefaultsIfNotSet() |
||
| 98 | ->children() |
||
| 99 | ->booleanNode('content_maximized') |
||
| 100 | ->info('Whether the page content should span the entire browser width, instead of a defined max width.') |
||
| 101 | ->defaultTrue() |
||
| 102 | ->end() |
||
| 103 | ->booleanNode('sidebar_minimized') |
||
| 104 | ->info('Whether the sidebar (which contains the main menu) should be displayed as a narrow column instead of the expanded design.') |
||
| 105 | ->defaultFalse() |
||
| 106 | ->end() |
||
| 107 | ->end() |
||
| 108 | ->end() |
||
| 109 | ->arrayNode('content') |
||
| 110 | ->info('Index page behavior.') |
||
| 111 | ->addDefaultsIfNotSet() |
||
| 112 | ->children() |
||
| 113 | ->scalarNode('template') |
||
| 114 | ->info('Render a template at the specified path.') |
||
| 115 | ->defaultNull() |
||
| 116 | ->end() |
||
| 117 | ->arrayNode('redirect') |
||
| 118 | ->info('Redirect to a specific page.') |
||
| 119 | ->addDefaultsIfNotSet() |
||
| 120 | ->children() |
||
| 121 | ->scalarNode('crud') |
||
| 122 | ->info('FQCN of a CRUD controller to use as default.') |
||
| 123 | ->defaultNull() |
||
| 124 | ->end() |
||
| 125 | ->scalarNode('route') |
||
| 126 | ->info('Arbitrary route to use as default.') |
||
| 127 | ->defaultValue('zikulathemebundle_branding_overview') |
||
| 128 | ->end() |
||
| 129 | ->arrayNode('route_parameters') |
||
| 130 | ->info('Array of route parameters (each defined by "name" and "value" entries).') |
||
| 131 | ->useAttributeAsKey('name') |
||
| 132 | ->arrayPrototype() |
||
| 133 | ->children() |
||
| 134 | ->scalarNode('name')->end() |
||
| 135 | ->scalarNode('value')->end() |
||
| 136 | ->end() |
||
| 137 | ->end() |
||
| 138 | ->end() |
||
| 139 | ->end() |
||
| 140 | ->end() |
||
| 141 | ->end() |
||
| 142 | ->end() |
||
| 143 | ->end() |
||
| 144 | ->end() |
||
| 145 | ->booleanNode('use_compression') |
||
| 146 | ->info('Whether to enable output compression (requires PHP Zlib extension).') |
||
| 147 | ->defaultFalse() |
||
| 148 | ->end() |
||
| 149 | ->end() |
||
| 150 | ; |
||
| 151 | |||
| 152 | return $treeBuilder; |
||
| 153 | } |
||
| 155 |