Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Code Lines | 40 |
Lines | 0 |
Ratio | 0 % |
Tests | 53 |
CRAP Score | 1 |
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 |
||
12 | 1 | public static function get() : array { |
|
13 | 1 | return [ |
|
14 | 1 | 'VR' => new props('exact', [ |
|
15 | 1 | 'type' => 'human', |
|
16 | 1 | 'category' => 'vr' |
|
17 | 1 | ]), |
|
18 | 1 | 'Mobile' => new props('exact', [ |
|
19 | 1 | 'type' => 'human', |
|
20 | 1 | 'category' => 'mobile' |
|
21 | 1 | ]), |
|
22 | 1 | 'Phone' => new props('any', [ |
|
23 | 1 | 'type' => 'human', |
|
24 | 1 | 'category' => 'mobile' |
|
25 | 1 | ]), |
|
26 | 1 | 'PDA' => new props('exact', [ |
|
27 | 1 | 'type' => 'human', |
|
28 | 1 | 'category' => 'mobile' |
|
29 | 1 | ]), |
|
30 | 1 | 'Tablet' => new props('exact', [ |
|
31 | 1 | 'type' => 'human', |
|
32 | 1 | 'category' => 'tablet' |
|
33 | 1 | ]), |
|
34 | 1 | 'TAB ' => new props('start', [ |
|
35 | 1 | 'type' => 'human', |
|
36 | 1 | 'category' => 'tablet' |
|
37 | 1 | ]), |
|
38 | 1 | 'TAB_' => new props('start', [ |
|
39 | 1 | 'type' => 'human', |
|
40 | 1 | 'category' => 'tablet' |
|
41 | 1 | ]), |
|
42 | 1 | 'Large Screen' => new props('exact', [ |
|
43 | 1 | 'type' => 'human', |
|
44 | 1 | 'category' => 'tv' |
|
45 | 1 | ]), |
|
46 | 1 | 'TV' => new props('exact', [ |
|
47 | 1 | 'type' => 'human', |
|
48 | 1 | 'category' => 'tv' |
|
49 | 1 | ]), |
|
50 | 1 | 'Smart TV' => new props('exact', [ |
|
51 | 1 | 'type' => 'human', |
|
52 | 1 | 'category' => 'tv' |
|
53 | 1 | ]), |
|
54 | 1 | 'SmartTV' => new props('exact', [ |
|
55 | 1 | 'type' => 'human', |
|
56 | 1 | 'category' => 'tv' |
|
57 | 1 | ]), |
|
58 | 1 | 'SMART-TV' => new props('exact', [ |
|
59 | 1 | 'type' => 'human', |
|
60 | 1 | 'category' => 'tv' |
|
61 | 1 | ]), |
|
62 | 1 | 'DTV' => new props('exact', [ |
|
63 | 1 | 'type' => 'human', |
|
64 | 1 | 'category' => 'tv' |
|
65 | 1 | ]) |
|
68 | } |