Conditions | 9 |
Paths | 9 |
Total Lines | 94 |
Code Lines | 80 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
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 |
||
32 | public static function censusPlaces(string $locale): array |
||
33 | { |
||
34 | switch ($locale) { |
||
35 | case 'cs': |
||
36 | return [ |
||
37 | new CensusOfCzechRepublic(), |
||
38 | new CensusOfSlovakia(), |
||
39 | new CensusOfDenmark(), |
||
40 | new CensusOfDeutschland(), |
||
41 | new CensusOfEngland(), |
||
42 | new CensusOfFrance(), |
||
43 | new CensusOfScotland(), |
||
44 | new CensusOfUnitedStates(), |
||
45 | new CensusOfWales(), |
||
46 | ]; |
||
47 | |||
48 | case 'en-AU': |
||
49 | case 'en-GB': |
||
50 | return [ |
||
51 | new CensusOfEngland(), |
||
52 | new CensusOfScotland(), |
||
53 | new CensusOfWales(), |
||
54 | new CensusOfUnitedStates(), |
||
55 | new CensusOfCzechRepublic(), |
||
56 | new CensusOfDenmark(), |
||
57 | new CensusOfDeutschland(), |
||
58 | new CensusOfFrance(), |
||
59 | new CensusOfSlovakia(), |
||
60 | ]; |
||
61 | |||
62 | case 'en-US': |
||
63 | return [ |
||
64 | new CensusOfUnitedStates(), |
||
65 | new CensusOfCzechRepublic(), |
||
66 | new CensusOfDenmark(), |
||
67 | new CensusOfDeutschland(), |
||
68 | new CensusOfEngland(), |
||
69 | new CensusOfFrance(), |
||
70 | new CensusOfScotland(), |
||
71 | new CensusOfSlovakia(), |
||
72 | new CensusOfWales(), |
||
73 | ]; |
||
74 | |||
75 | case 'fr': |
||
76 | case 'fr-CA': |
||
77 | return [ |
||
78 | new CensusOfFrance(), |
||
79 | new CensusOfCzechRepublic(), |
||
80 | new CensusOfDenmark(), |
||
81 | new CensusOfDeutschland(), |
||
82 | new CensusOfEngland(), |
||
83 | new CensusOfScotland(), |
||
84 | new CensusOfSlovakia(), |
||
85 | new CensusOfUnitedStates(), |
||
86 | new CensusOfWales(), |
||
87 | ]; |
||
88 | |||
89 | case 'da': |
||
90 | return [ |
||
91 | new CensusOfDenmark(), |
||
92 | new CensusOfDeutschland(), |
||
93 | new CensusOfCzechRepublic(), |
||
94 | new CensusOfEngland(), |
||
95 | new CensusOfFrance(), |
||
96 | new CensusOfScotland(), |
||
97 | new CensusOfSlovakia(), |
||
98 | new CensusOfUnitedStates(), |
||
99 | new CensusOfWales(), |
||
100 | ]; |
||
101 | |||
102 | case 'de': |
||
103 | return [ |
||
104 | new CensusOfDeutschland(), |
||
105 | new CensusOfCzechRepublic(), |
||
106 | new CensusOfDenmark(), |
||
107 | new CensusOfEngland(), |
||
108 | new CensusOfFrance(), |
||
109 | new CensusOfScotland(), |
||
110 | new CensusOfSlovakia(), |
||
111 | new CensusOfUnitedStates(), |
||
112 | new CensusOfWales(), |
||
113 | ]; |
||
114 | |||
115 | default: |
||
116 | return [ |
||
117 | new CensusOfUnitedStates(), |
||
118 | new CensusOfEngland(), |
||
119 | new CensusOfScotland(), |
||
120 | new CensusOfWales(), |
||
121 | new CensusOfDeutschland(), |
||
122 | new CensusOfFrance(), |
||
123 | new CensusOfCzechRepublic(), |
||
124 | new CensusOfSlovakia(), |
||
125 | new CensusOfDenmark(), |
||
126 | ]; |
||
130 |