Conditions | 1 |
Paths | 1 |
Total Lines | 74 |
Code Lines | 59 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 1.0046 |
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 |
||
8 | 4 | public function getOptions() |
|
9 | { |
||
10 | 4 | return [ |
|
11 | 'Detection' => [ |
||
12 | 'Rules' => [ |
||
13 | 'BotBlock' => [ |
||
14 | 'active' => 1, |
||
15 | 4 | 'score' => 1, |
|
16 | 'params' => '360Spider' |
||
17 | ], |
||
18 | 'Html' => [ |
||
19 | 'active' => 1, |
||
20 | 'score' => 1, |
||
21 | 'params' => '', |
||
22 | ], |
||
23 | 'StringLength' => [ |
||
24 | 'active' => 1, |
||
25 | 'score' => 1, |
||
26 | 'params' => '', |
||
27 | ], |
||
28 | 'Numeric' => [ |
||
29 | 'active' => 1, |
||
30 | 'score' => 1, |
||
31 | 'params' => '', |
||
32 | ], |
||
33 | 'Url' => [ |
||
34 | 'active' => 1, |
||
35 | 'score' => 1, |
||
36 | 'params' => '', |
||
37 | ], |
||
38 | 'Ip' => [ |
||
39 | 'active' => 1, |
||
40 | 'score' => 1, |
||
41 | 'params' => '', |
||
42 | ], |
||
43 | 'Tor' => [ |
||
44 | 'active' => 1, |
||
45 | 'score' => 1, |
||
46 | 'params' => '', |
||
47 | ], |
||
48 | 'DisposableEmail' => [ |
||
49 | 'active' => 1, |
||
50 | 'score' => 10, |
||
51 | 'params' => '', |
||
52 | ], |
||
53 | 'InvalidEmail' => [ |
||
54 | 'active' => 1, |
||
55 | 'score' => 1, |
||
56 | 'params' => '', |
||
57 | ], |
||
58 | 'QueryStringKey' => [ |
||
59 | 'active' => 1, |
||
60 | 'score' => 1, |
||
61 | 'params' => '', |
||
62 | ], |
||
63 | 'QueryStringValue' => [ |
||
64 | 'active' => 1, |
||
65 | 'score' => 1, |
||
66 | 'params' => '', |
||
67 | ], |
||
68 | 'DifferentCountry' => [ |
||
69 | 'active' => 1, |
||
70 | 'score' => 10, |
||
71 | 'params' => '', |
||
72 | ], |
||
73 | 'Country' => [ |
||
74 | 'active' => 1, |
||
75 | 'score' => 10, |
||
76 | 'params' => '', |
||
77 | ], |
||
78 | 'Xss' => [ |
||
79 | 4 | 'active' => 1, |
|
80 | 'score' => 10, |
||
81 | 4 | 'params' => '', |
|
82 | ] |
||
94 | } |
This check looks for private methods that have been defined, but are not used inside the class.