Conditions | 1 |
Paths | 1 |
Total Lines | 78 |
Code Lines | 39 |
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 |
||
55 | public function providerDCount(): array |
||
56 | { |
||
57 | return [ |
||
58 | [ |
||
59 | 1, |
||
60 | $this->database1(), |
||
61 | 'Age', |
||
62 | [ |
||
63 | ['Tree', 'Height', 'Height'], |
||
64 | ['=Apple', '>10', '<16'], |
||
65 | ], |
||
66 | ], |
||
67 | [ |
||
68 | 1, |
||
69 | $this->database3(), |
||
70 | 'Score', |
||
71 | [ |
||
72 | ['Subject', 'Gender'], |
||
73 | ['Science', 'Male'], |
||
74 | ], |
||
75 | ], |
||
76 | [ |
||
77 | 1, |
||
78 | $this->database3(), |
||
79 | 'Score', |
||
80 | [ |
||
81 | ['Subject', 'Gender'], |
||
82 | ['Math', 'Female'], |
||
83 | ], |
||
84 | ], |
||
85 | [ |
||
86 | 3, |
||
87 | $this->database4(), |
||
88 | 'Value', |
||
89 | [ |
||
90 | ['Status'], |
||
91 | [true], |
||
92 | ], |
||
93 | ], |
||
94 | [ |
||
95 | 5, |
||
96 | $this->database4(), |
||
97 | 'Value', |
||
98 | [ |
||
99 | ['Status'], |
||
100 | ['<>true'], |
||
101 | ], |
||
102 | ], |
||
103 | 'field column number okay' => [ |
||
104 | 0, |
||
105 | $this->database1(), |
||
106 | 1, |
||
107 | $this->database1(), |
||
108 | ], |
||
109 | 'omitted field name' => [ |
||
110 | ExcelError::VALUE(), |
||
111 | $this->database3(), |
||
112 | null, |
||
113 | [ |
||
114 | ['Subject', 'Score'], |
||
115 | ['English', '>63%'], |
||
116 | ], |
||
117 | ], |
||
118 | /* Excel seems to return #NAME? when column number |
||
119 | is too high or too low. This makes so little sense |
||
120 | to me that I'm not going to bother coding that up, |
||
121 | content to return #VALUE! as an invalid name would */ |
||
122 | 'field column number too high' => [ |
||
123 | ExcelError::VALUE(), |
||
124 | $this->database1(), |
||
125 | 99, |
||
126 | $this->database1(), |
||
127 | ], |
||
128 | 'field column number too low' => [ |
||
129 | ExcelError::VALUE(), |
||
130 | $this->database1(), |
||
131 | 0, |
||
132 | $this->database1(), |
||
133 | ], |
||
137 |