| Conditions | 2 |
| Paths | 2 |
| Total Lines | 61 |
| Code Lines | 47 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| 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 |
||
| 14 | public function getConfigTreeBuilder() |
||
| 15 | { |
||
| 16 | $treeBuilder = new TreeBuilder('dh_doctrine_audit'); |
||
| 17 | |||
| 18 | // Keep compatibility with symfony/config < 4.2 |
||
| 19 | /** @var ParentNodeDefinitionInterface $rootNode */ |
||
| 20 | $rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('dh_doctrine_audit'); |
||
| 21 | |||
| 22 | $rootNode |
||
| 23 | ->children() |
||
| 24 | ->scalarNode('enabled') |
||
| 25 | ->defaultTrue() |
||
| 26 | ->end() |
||
| 27 | |||
| 28 | ->scalarNode('enabled_viewer') |
||
|
|
|||
| 29 | ->defaultTrue() |
||
| 30 | ->end() |
||
| 31 | |||
| 32 | ->scalarNode('storage_entity_manager') |
||
| 33 | ->cannotBeEmpty() |
||
| 34 | ->defaultNull() |
||
| 35 | ->end() |
||
| 36 | |||
| 37 | ->scalarNode('table_prefix') |
||
| 38 | ->defaultValue('') |
||
| 39 | ->end() |
||
| 40 | ->scalarNode('table_suffix') |
||
| 41 | ->defaultValue('_audit') |
||
| 42 | ->end() |
||
| 43 | |||
| 44 | ->arrayNode('ignored_columns') |
||
| 45 | ->canBeUnset() |
||
| 46 | ->prototype('scalar')->end() |
||
| 47 | ->end() |
||
| 48 | |||
| 49 | ->scalarNode('timezone') |
||
| 50 | ->defaultValue('UTC') |
||
| 51 | ->end() |
||
| 52 | |||
| 53 | ->arrayNode('entities') |
||
| 54 | ->canBeUnset() |
||
| 55 | ->prototype('array') |
||
| 56 | ->children() |
||
| 57 | ->arrayNode('ignored_columns') |
||
| 58 | ->canBeUnset() |
||
| 59 | ->prototype('scalar')->end() |
||
| 60 | ->end() |
||
| 61 | ->booleanNode('enabled') |
||
| 62 | ->defaultTrue() |
||
| 63 | ->end() |
||
| 64 | ->arrayNode('roles') |
||
| 65 | ->canBeUnset() |
||
| 66 | ->prototype('scalar')->end() |
||
| 67 | ->end() |
||
| 68 | ->end() |
||
| 69 | ->end() |
||
| 70 | ->end() |
||
| 71 | ->end() |
||
| 72 | ; |
||
| 73 | |||
| 74 | return $treeBuilder; |
||
| 75 | } |
||
| 77 |