| Conditions | 1 |
| Paths | 1 |
| Total Lines | 125 |
| Code Lines | 116 |
| 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 |
||
| 22 | public function getConfigTreeBuilder() : TreeBuilder |
||
| 23 | { |
||
| 24 | $treeBuilder = new TreeBuilder(); |
||
| 25 | $rootNode = $treeBuilder->root(self::BUNDLE_TREEBUILDER_ROOT); |
||
| 26 | $rootNode |
||
| 27 | ->children() |
||
| 28 | ->arrayNode('rewrite') |
||
| 29 | ->info('Optional rewrite configuration') |
||
| 30 | ->addDefaultsIfNotSet() |
||
| 31 | ->children() |
||
| 32 | ->booleanNode('remove_trailing_slash') |
||
| 33 | ->info('Enable remove trailing slash in urls') |
||
| 34 | ->defaultValue(false) |
||
| 35 | ->end() |
||
| 36 | ->end() |
||
| 37 | ->end() |
||
| 38 | ->arrayNode('translation') |
||
| 39 | ->info('Optional translation configuration') |
||
| 40 | ->addDefaultsIfNotSet() |
||
| 41 | ->children() |
||
| 42 | ->booleanNode('enabled') |
||
| 43 | ->info('Wether translation should be enabled or not for SEO meta tags') |
||
| 44 | ->defaultValue(false) |
||
| 45 | ->end() |
||
| 46 | ->scalarNode('domain') |
||
| 47 | ->info('Domain for translatable meta contents (if "null", use the app default domain)') |
||
| 48 | ->defaultValue(null) |
||
| 49 | ->end() |
||
| 50 | ->end() |
||
| 51 | ->end() |
||
| 52 | ->arrayNode('title') |
||
| 53 | ->info('Home for the title tag configuration') |
||
| 54 | ->children() |
||
| 55 | ->scalarNode('default') |
||
| 56 | ->info('Fallback value for title when no title defined for the requested route') |
||
| 57 | ->isRequired() |
||
| 58 | ->end() |
||
| 59 | ->arrayNode('pages') |
||
| 60 | ->info('Config for titles on a per-route basis') |
||
| 61 | ->prototype('scalar') |
||
| 62 | ->end() |
||
| 63 | ->end() |
||
| 64 | ->end() |
||
| 65 | ->end() |
||
| 66 | ->arrayNode('metas') |
||
| 67 | ->info('Home for the meta tags configuration') |
||
| 68 | ->children() |
||
| 69 | ->arrayNode('defaults') |
||
| 70 | ->info('Fallback values for meta tags when no config found for the requested route') |
||
| 71 | ->isRequired() |
||
| 72 | ->requiresAtLeastOneElement() |
||
| 73 | ->prototype('array') |
||
| 74 | ->children() |
||
| 75 | // Here an exhaustive list of all possible attributes for a <meta> tag |
||
| 76 | // Problem, name/charset/http-equiv/itemprop should be an EXCLUSIVE choice |
||
| 77 | ->scalarNode('name') |
||
| 78 | ->end() |
||
| 79 | ->scalarNode('charset') |
||
| 80 | ->end() |
||
| 81 | ->scalarNode('http-equiv') |
||
| 82 | ->end() |
||
| 83 | ->scalarNode('itemprop') |
||
| 84 | ->end() |
||
| 85 | ->scalarNode('content') |
||
| 86 | ->end() |
||
| 87 | ->scalarNode('property') |
||
| 88 | ->end() |
||
| 89 | ->end() |
||
| 90 | ->end() |
||
| 91 | ->end() |
||
| 92 | ->arrayNode('pages') |
||
| 93 | ->info('Config for meta informations on a per-route basis') |
||
| 94 | ->prototype('array') |
||
| 95 | ->prototype('array') |
||
| 96 | ->children() |
||
| 97 | ->scalarNode('name') |
||
| 98 | ->end() |
||
| 99 | ->scalarNode('charset') |
||
| 100 | ->end() |
||
| 101 | ->scalarNode('http-equiv') |
||
| 102 | ->end() |
||
| 103 | ->scalarNode('itemprop') |
||
| 104 | ->end() |
||
| 105 | ->scalarNode('content') |
||
| 106 | ->end() |
||
| 107 | ->scalarNode('property') |
||
| 108 | ->end() |
||
| 109 | ->end() |
||
| 110 | ->end() |
||
| 111 | ->end() |
||
| 112 | ->end() |
||
| 113 | ->end() |
||
| 114 | |||
| 115 | ->end() |
||
| 116 | |||
| 117 | ->arrayNode('links') |
||
| 118 | ->info('Home for the link tags configuration') |
||
| 119 | ->children() |
||
| 120 | ->arrayNode('pages') |
||
| 121 | ->prototype('array') |
||
| 122 | ->prototype('array') |
||
| 123 | ->children() |
||
| 124 | // Here an exhaustive list of all possible attributes for a <link> tag |
||
| 125 | ->scalarNode('rel') |
||
| 126 | ->end() |
||
| 127 | ->scalarNode('href') |
||
| 128 | ->end() |
||
| 129 | ->scalarNode('hreflang') |
||
| 130 | ->end() |
||
| 131 | ->scalarNode('media') |
||
| 132 | ->end() |
||
| 133 | ->scalarNode('title') |
||
| 134 | ->end() |
||
| 135 | ->scalarNode('type') |
||
| 136 | ->end() |
||
| 137 | ->end() |
||
| 138 | ->end() |
||
| 139 | ->end() |
||
| 140 | ->end() |
||
| 141 | ->end() |
||
| 142 | ->end() |
||
| 143 | |||
| 144 | ->end(); |
||
| 145 | |||
| 146 | return $treeBuilder; |
||
| 147 | } |
||
| 149 |