| Conditions | 1 |
| Paths | 1 |
| Total Lines | 231 |
| Code Lines | 220 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 15 | public function getConfigTreeBuilder() |
||
| 16 | { |
||
| 17 | $treeBuilder = new TreeBuilder(); |
||
| 18 | $rootNode = $treeBuilder->root('sludio_helper'); |
||
| 19 | |||
| 20 | // @formatter:off |
||
| 21 | $rootNode |
||
| 22 | ->children() |
||
| 23 | ->arrayNode('extensions') |
||
| 24 | ->addDefaultsIfNotSet() |
||
| 25 | ->children() |
||
| 26 | ->arrayNode('captcha') |
||
| 27 | ->addDefaultsIfNotSet() |
||
| 28 | ->canBeEnabled() |
||
| 29 | ->children() |
||
| 30 | ->arrayNode('clients') |
||
| 31 | ->prototype('array') |
||
| 32 | ->prototype('variable')->end() |
||
| 33 | ->end() |
||
| 34 | ->end() |
||
| 35 | ->end() |
||
| 36 | ->end() |
||
| 37 | ->arrayNode('guzzle') |
||
| 38 | ->addDefaultsIfNotSet() |
||
| 39 | ->canBeEnabled() |
||
| 40 | ->children() |
||
| 41 | ->arrayNode('profiler') |
||
| 42 | ->canBeEnabled() |
||
| 43 | ->children() |
||
| 44 | ->integerNode('max_body_size') |
||
| 45 | ->defaultValue(GuzzleCollector::MAX_BODY_SIZE) |
||
| 46 | ->end() |
||
| 47 | ->end() |
||
| 48 | ->end() |
||
| 49 | ->arrayNode('logger') |
||
| 50 | ->canBeEnabled() |
||
| 51 | ->children() |
||
| 52 | ->scalarNode('service')->defaultValue(null)->end() |
||
| 53 | ->scalarNode('format') |
||
| 54 | ->beforeNormalization() |
||
| 55 | ->ifInArray(['clf', 'debug', 'short']) |
||
| 56 | ->then(function ($v) { |
||
| 57 | return constant('GuzzleHttp\MessageFormatter::'.strtoupper($v)); |
||
| 58 | }) |
||
| 59 | ->end() |
||
| 60 | ->defaultValue(MessageFormatter::CLF) |
||
| 61 | ->end() |
||
| 62 | ->scalarNode('level') |
||
| 63 | ->beforeNormalization() |
||
| 64 | ->ifInArray([ |
||
| 65 | 'emergency', 'alert', 'critical', 'error', |
||
| 66 | 'warning', 'notice', 'info', 'debug', |
||
| 67 | ]) |
||
| 68 | ->then(function ($v) { |
||
| 69 | return constant('Psr\Log\LogLevel::'.strtoupper($v)); |
||
| 70 | }) |
||
| 71 | ->end() |
||
| 72 | ->defaultValue('debug') |
||
| 73 | ->end() |
||
| 74 | ->end() |
||
| 75 | ->end() |
||
| 76 | ->append($this->createCacheNode()) |
||
| 77 | ->append($this->createClientsNode()) |
||
| 78 | ->append($this->createMockNode()) |
||
| 79 | ->end() |
||
| 80 | ->end() |
||
| 81 | ->arrayNode('lexik') |
||
| 82 | ->addDefaultsIfNotSet() |
||
| 83 | ->canBeEnabled() |
||
| 84 | ->children() |
||
| 85 | ->scalarNode('default_domain')->defaultValue('messages')->end() |
||
| 86 | ->arrayNode('default_selections') |
||
| 87 | ->addDefaultsIfNotSet() |
||
| 88 | ->children() |
||
| 89 | ->booleanNode('non_translated_only')->defaultValue(false)->end() |
||
| 90 | ->end() |
||
| 91 | ->end() |
||
| 92 | ->arrayNode('empty_prefixes') |
||
| 93 | ->defaultValue(array('__', 'new_', '')) |
||
| 94 | ->prototype('array')->end() |
||
| 95 | ->end() |
||
| 96 | ->arrayNode('editable') |
||
| 97 | ->addDefaultsIfNotSet() |
||
| 98 | ->children() |
||
| 99 | ->scalarNode('type')->defaultValue('textarea')->end() |
||
| 100 | ->scalarNode('emptytext')->defaultValue('Empty')->end() |
||
| 101 | ->end() |
||
| 102 | ->end() |
||
| 103 | ->end() |
||
| 104 | ->end() |
||
| 105 | ->arrayNode('oauth') |
||
| 106 | ->addDefaultsIfNotSet() |
||
| 107 | ->canBeEnabled() |
||
| 108 | ->children() |
||
| 109 | ->arrayNode('clients') |
||
| 110 | ->prototype('array') |
||
| 111 | ->prototype('variable')->end() |
||
| 112 | ->end() |
||
| 113 | ->end() |
||
| 114 | ->arrayNode('custom_providers') |
||
| 115 | ->prototype('array') |
||
| 116 | ->prototype('variable')->end() |
||
| 117 | ->end() |
||
| 118 | ->end() |
||
| 119 | ->end() |
||
| 120 | ->end() |
||
| 121 | ->arrayNode('openid') |
||
| 122 | ->addDefaultsIfNotSet() |
||
| 123 | ->canBeEnabled() |
||
| 124 | ->children() |
||
| 125 | ->arrayNode('clients') |
||
| 126 | ->prototype('array') |
||
| 127 | ->prototype('variable')->end() |
||
| 128 | ->end() |
||
| 129 | ->end() |
||
| 130 | ->end() |
||
| 131 | ->end() |
||
| 132 | ->arrayNode('openidconnect') |
||
| 133 | ->addDefaultsIfNotSet() |
||
| 134 | ->canBeEnabled() |
||
| 135 | ->children() |
||
| 136 | ->arrayNode('clients') |
||
| 137 | ->prototype('array') |
||
| 138 | ->prototype('variable')->end() |
||
| 139 | ->end() |
||
| 140 | ->end() |
||
| 141 | ->end() |
||
| 142 | ->end() |
||
| 143 | ->arrayNode('pagination') |
||
| 144 | ->addDefaultsIfNotSet() |
||
| 145 | ->canBeEnabled() |
||
| 146 | ->children() |
||
| 147 | ->arrayNode('behaviour') |
||
| 148 | ->prototype('array') |
||
| 149 | ->prototype('variable')->end() |
||
| 150 | ->end() |
||
| 151 | ->end() |
||
| 152 | ->end() |
||
| 153 | ->end() |
||
| 154 | ->arrayNode('position') |
||
| 155 | ->addDefaultsIfNotSet() |
||
| 156 | ->canBeEnabled() |
||
| 157 | ->children() |
||
| 158 | ->arrayNode('field') |
||
| 159 | ->addDefaultsIfNotSet() |
||
| 160 | ->children() |
||
| 161 | ->scalarNode('default') |
||
| 162 | ->defaultValue('position') |
||
| 163 | ->end() |
||
| 164 | ->arrayNode('entities') |
||
| 165 | ->prototype('scalar')->end() |
||
| 166 | ->end() |
||
| 167 | ->end() |
||
| 168 | ->end() |
||
| 169 | ->end() |
||
| 170 | ->end() |
||
| 171 | ->arrayNode('script') |
||
| 172 | ->addDefaultsIfNotSet() |
||
| 173 | ->canBeEnabled() |
||
| 174 | ->children() |
||
| 175 | ->booleanNode('short_functions') |
||
| 176 | ->defaultValue(false) |
||
| 177 | ->end() |
||
| 178 | ->end() |
||
| 179 | ->end() |
||
| 180 | ->arrayNode('translatable') |
||
| 181 | ->addDefaultsIfNotSet() |
||
| 182 | ->canBeEnabled() |
||
| 183 | ->children() |
||
| 184 | ->arrayNode('locales') |
||
| 185 | ->beforeNormalization() |
||
| 186 | ->ifString() |
||
| 187 | ->then(function($v) { |
||
| 188 | return preg_split('/\s*,\s*/', $v); |
||
| 189 | }) |
||
| 190 | ->end() |
||
| 191 | ->prototype('scalar')->end() |
||
| 192 | ->end() |
||
| 193 | ->scalarNode('default_locale') |
||
| 194 | ->defaultValue('en') |
||
| 195 | ->end() |
||
| 196 | ->scalarNode('template') |
||
| 197 | ->defaultValue('SludioHelperBundle:Translatable:translations.html.twig') |
||
| 198 | ->end() |
||
| 199 | ->scalarNode('table') |
||
| 200 | ->defaultValue('sludio_helper_translation') |
||
| 201 | ->end() |
||
| 202 | ->scalarNode('manager') |
||
| 203 | ->defaultValue('default') |
||
| 204 | ->end() |
||
| 205 | ->end() |
||
| 206 | ->end() |
||
| 207 | ->end() |
||
| 208 | ->end() |
||
| 209 | ->arrayNode('other') |
||
| 210 | ->addDefaultsIfNotSet() |
||
| 211 | ->children() |
||
| 212 | ->arrayNode('logger') |
||
| 213 | ->addDefaultsIfNotSet() |
||
| 214 | ->children() |
||
| 215 | ->scalarNode('class') |
||
| 216 | ->defaultValue('Sludio\HelperBundle\Logger\SludioLogger') |
||
| 217 | ->end() |
||
| 218 | ->end() |
||
| 219 | ->end() |
||
| 220 | ->arrayNode('redis') |
||
| 221 | ->addDefaultsIfNotSet() |
||
| 222 | ->children() |
||
| 223 | ->scalarNode('translation') |
||
| 224 | ->defaultValue('session') |
||
| 225 | ->end() |
||
| 226 | ->end() |
||
| 227 | ->end() |
||
| 228 | ->arrayNode('entity') |
||
| 229 | ->addDefaultsIfNotSet() |
||
| 230 | ->children() |
||
| 231 | ->scalarNode('manager') |
||
| 232 | ->defaultValue('default') |
||
| 233 | ->end() |
||
| 234 | ->end() |
||
| 235 | ->end() |
||
| 236 | ->scalarNode('locale') |
||
| 237 | ->defaultValue('en') |
||
| 238 | ->end() |
||
| 239 | ->end() |
||
| 240 | ->end() |
||
| 241 | ->end() |
||
| 242 | ; |
||
| 243 | // @formatter:on |
||
| 244 | |||
| 245 | return $treeBuilder; |
||
| 246 | } |
||
| 324 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths