Conditions | 1 |
Paths | 1 |
Total Lines | 72 |
Code Lines | 59 |
Lines | 0 |
Ratio | 0 % |
Tests | 59 |
CRAP Score | 1 |
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 |
||
18 | 4 | public function getConfigTreeBuilder() |
|
19 | { |
||
20 | 4 | $treeBuilder = new TreeBuilder(); |
|
21 | 4 | $rootNode = $treeBuilder->root('login_cidadao_phone_verification'); |
|
22 | |||
23 | $rootNode |
||
24 | 4 | ->children() |
|
25 | 4 | ->booleanNode('enabled') |
|
26 | 4 | ->defaultFalse() |
|
27 | 4 | ->end() |
|
28 | // User's will HAVE TO verify their phone number after X accounts are using it |
||
29 | 4 | ->scalarNode('require_validation_threshold') |
|
30 | 4 | ->defaultValue(3) |
|
31 | 4 | ->end() |
|
32 | 4 | ->arrayNode('verification_code') |
|
33 | 4 | ->addDefaultsIfNotSet() |
|
34 | 4 | ->children() |
|
35 | 4 | ->integerNode('length') |
|
36 | 4 | ->defaultValue(6) |
|
37 | 4 | ->end() |
|
38 | 4 | ->booleanNode('use_numbers') |
|
39 | 4 | ->defaultTrue() |
|
40 | 4 | ->end() |
|
41 | 4 | ->booleanNode('case_sensitive') |
|
42 | 4 | ->defaultFalse() |
|
43 | 4 | ->end() |
|
44 | 4 | ->booleanNode('use_lower') |
|
45 | 4 | ->defaultFalse() |
|
46 | 4 | ->end() |
|
47 | 4 | ->booleanNode('use_upper') |
|
48 | 4 | ->defaultFalse() |
|
49 | 4 | ->end() |
|
50 | 4 | ->end() |
|
51 | 4 | ->end() |
|
52 | |||
53 | 4 | ->arrayNode('verification_token') |
|
54 | 4 | ->addDefaultsIfNotSet() |
|
55 | 4 | ->children() |
|
56 | 4 | ->integerNode('length') |
|
57 | 4 | ->defaultValue(6) |
|
58 | 4 | ->end() |
|
59 | 4 | ->end() |
|
60 | 4 | ->end() |
|
61 | |||
62 | 4 | ->arrayNode('sms') |
|
63 | 4 | ->addDefaultsIfNotSet() |
|
64 | 4 | ->children() |
|
65 | 4 | ->scalarNode('resend_timeout') |
|
66 | 4 | ->defaultValue('+5 minutes') |
|
67 | 4 | ->end() |
|
68 | 4 | ->end() |
|
69 | 4 | ->end() |
|
70 | |||
71 | 4 | ->arrayNode('blocklist') |
|
72 | 4 | ->addDefaultsIfNotSet() |
|
73 | 4 | ->children() |
|
74 | 4 | ->booleanNode('enable_auto_block') |
|
75 | 4 | ->defaultValue(true) |
|
76 | 4 | ->end() |
|
77 | // A phone will get block-listed after X accounts are using it |
||
78 | 4 | ->scalarNode('auto_block_limit') |
|
79 | 4 | ->defaultValue(10) |
|
80 | 4 | ->end() |
|
81 | 4 | ->end() |
|
82 | 4 | ->end() |
|
83 | 4 | ->end(); |
|
84 | |||
85 | // Here you should define the parameters that are allowed to |
||
86 | // configure your bundle. See the documentation linked above for |
||
87 | // more information on that topic. |
||
88 | |||
89 | 4 | return $treeBuilder; |
|
90 | } |
||
92 |