| Conditions | 1 |
| Paths | 1 |
| Total Lines | 67 |
| 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 |
||
| 13 | public function getConfigTreeBuilder() |
||
| 14 | { |
||
| 15 | $treeBuilder = new TreeBuilder(); |
||
| 16 | $rootNode = $treeBuilder->root('ftrrtf_rollbar'); |
||
| 17 | |||
| 18 | $rootNode |
||
| 19 | ->children() |
||
| 20 | ->arrayNode('notifier') |
||
| 21 | ->isRequired() |
||
| 22 | ->children() |
||
| 23 | ->arrayNode('server') |
||
| 24 | ->children() |
||
| 25 | ->scalarNode('batched')->defaultFalse()->end() |
||
| 26 | ->scalarNode('batch_size')->defaultValue('50')->end() |
||
| 27 | ->arrayNode('transport') |
||
| 28 | ->children() |
||
| 29 | ->scalarNode('type')->defaultValue('curl')->end() |
||
| 30 | ->scalarNode('access_token')->end() |
||
| 31 | ->scalarNode('agent_log_location')->end() |
||
| 32 | ->end() |
||
| 33 | ->end() |
||
| 34 | ->end() |
||
| 35 | ->end() |
||
| 36 | ->arrayNode('client') |
||
| 37 | ->children() |
||
| 38 | ->scalarNode('access_token')->end() |
||
| 39 | ->booleanNode('source_map_enabled') |
||
| 40 | ->defaultFalse() |
||
| 41 | ->end() |
||
| 42 | ->scalarNode('code_version') |
||
| 43 | ->defaultValue('') |
||
| 44 | ->end() |
||
| 45 | ->booleanNode('guess_uncaught_frames') |
||
| 46 | ->defaultFalse() |
||
| 47 | ->end() |
||
| 48 | ->scalarNode('rollbarjs_version') |
||
| 49 | ->defaultValue('v1') |
||
| 50 | ->end() |
||
| 51 | ->scalarNode('check_ignore_function_provider') |
||
| 52 | ->defaultValue('ftrrtf_rollbar.check_ignore_function_provider.default') |
||
| 53 | ->end() |
||
| 54 | ->scalarNode('transform_payload_function_provider') |
||
| 55 | ->defaultValue('ftrrtf_rollbar.transform_payload_function_provider.default') |
||
| 56 | ->end() |
||
| 57 | ->arrayNode('allowed_js_hosts') |
||
| 58 | ->prototype('scalar') |
||
| 59 | ->end() |
||
| 60 | ->end() |
||
| 61 | ->end() |
||
| 62 | ->end() |
||
| 63 | ->end() |
||
| 64 | ->end() |
||
| 65 | ->arrayNode('environment') |
||
| 66 | ->addDefaultsIfNotSet() |
||
| 67 | ->children() |
||
| 68 | ->scalarNode('branch')->defaultValue('master')->end() |
||
| 69 | ->scalarNode('root_dir')->defaultValue('')->end() |
||
| 70 | ->scalarNode('environment')->defaultValue('unknown')->end() |
||
| 71 | ->scalarNode('framework')->end() |
||
| 72 | ->scalarNode('code_version')->defaultValue('')->end() |
||
| 73 | ->booleanNode('anonymize')->defaultValue(false)->end() |
||
| 74 | ->end() |
||
| 75 | ->end() |
||
| 76 | ->end(); |
||
| 77 | |||
| 78 | return $treeBuilder; |
||
| 79 | } |
||
| 80 | } |
||
| 81 |