Conditions | 3 |
Paths | 1 |
Total Lines | 52 |
Code Lines | 40 |
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 |
||
26 | public function getConfigTreeBuilder() |
||
27 | { |
||
28 | $treeBuilder = new TreeBuilder; |
||
29 | |||
30 | $treeBuilder |
||
31 | ->root('surfnet_stepup_gateway_u2f_verification') |
||
32 | ->children() |
||
33 | ->arrayNode('migrations') |
||
34 | ->addDefaultsIfNotSet() |
||
35 | ->children() |
||
36 | ->scalarNode('diff_entity_manager') |
||
37 | ->info( |
||
38 | 'This is the name of the Doctrine entity manager that is used for schema ' . |
||
39 | 'diffing. If it is unspecified, or NULL, the default entity manager is used.' |
||
40 | ) |
||
41 | ->defaultNull() |
||
42 | ->validate() |
||
43 | ->ifTrue( |
||
44 | function ($entityManagerName) { |
||
45 | return !is_string($entityManagerName) && $entityManagerName !== null; |
||
46 | } |
||
47 | ) |
||
48 | ->thenInvalid( |
||
49 | 'surfnet_stepup_gateway_u2f_verification.migrations.diff_entity_manager should ' . |
||
50 | 'be a string or NULL' |
||
51 | ) |
||
52 | ->end() |
||
53 | ->end() |
||
54 | ->scalarNode('migrate_entity_manager') |
||
55 | ->info( |
||
56 | 'This is the name of the Doctrine entity manager that is used for migrations. ' . |
||
57 | 'If it is unspecified, or NULL, the default entity manager is used.' |
||
58 | ) |
||
59 | ->defaultNull() |
||
60 | ->validate() |
||
61 | ->ifTrue( |
||
62 | function ($entityManagerName) { |
||
63 | return !is_string($entityManagerName) && $entityManagerName !== null; |
||
64 | } |
||
65 | ) |
||
66 | ->thenInvalid( |
||
67 | 'surfnet_stepup_gateway_u2f_verification.migrations.migrate_entity_manager ' . |
||
68 | 'should be a string or NULL' |
||
69 | ) |
||
70 | ->end() |
||
71 | ->end() |
||
72 | ->end() |
||
73 | ->end() |
||
74 | ->end(); |
||
75 | |||
76 | return $treeBuilder; |
||
77 | } |
||
78 | } |
||
79 |