| Conditions | 8 | 
| Paths | 9 | 
| Total Lines | 174 | 
| 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  | 
            ||
| 45 | public function getErrorList($testFile)  | 
            ||
| 46 |     { | 
            ||
| 47 |         if ($testFile === 'FunctionCommentUnitTest.1.inc') { | 
            ||
| 48 | $errors = array(  | 
            ||
| 49 | 5 => 1,  | 
            ||
| 50 | 10 => 3,  | 
            ||
| 51 | 12 => 2,  | 
            ||
| 52 | 13 => 2,  | 
            ||
| 53 | 14 => 1,  | 
            ||
| 54 | 15 => 1,  | 
            ||
| 55 | 28 => 1,  | 
            ||
| 56 | 43 => 1,  | 
            ||
| 57 | 76 => 1,  | 
            ||
| 58 | 87 => 1,  | 
            ||
| 59 | 103 => 1,  | 
            ||
| 60 | 109 => 1,  | 
            ||
| 61 | 112 => 1,  | 
            ||
| 62 | 122 => 1,  | 
            ||
| 63 | 123 => 3,  | 
            ||
| 64 | 124 => 2,  | 
            ||
| 65 | 125 => 1,  | 
            ||
| 66 | 126 => 1,  | 
            ||
| 67 | 137 => 4,  | 
            ||
| 68 | 138 => 4,  | 
            ||
| 69 | 139 => 4,  | 
            ||
| 70 | 143 => 2,  | 
            ||
| 71 | 152 => 1,  | 
            ||
| 72 | 155 => 2,  | 
            ||
| 73 | 159 => 1,  | 
            ||
| 74 | 166 => 1,  | 
            ||
| 75 | 173 => 1,  | 
            ||
| 76 | 183 => 1,  | 
            ||
| 77 | 190 => 2,  | 
            ||
| 78 | 193 => 2,  | 
            ||
| 79 | 196 => 1,  | 
            ||
| 80 | 199 => 2,  | 
            ||
| 81 | 210 => 1,  | 
            ||
| 82 | 211 => 1,  | 
            ||
| 83 | 222 => 1,  | 
            ||
| 84 | 223 => 1,  | 
            ||
| 85 | 224 => 1,  | 
            ||
| 86 | 225 => 1,  | 
            ||
| 87 | 226 => 1,  | 
            ||
| 88 | 227 => 1,  | 
            ||
| 89 | 230 => 2,  | 
            ||
| 90 | 232 => 2,  | 
            ||
| 91 | 246 => 1,  | 
            ||
| 92 | 248 => 4,  | 
            ||
| 93 | 261 => 1,  | 
            ||
| 94 | 263 => 1,  | 
            ||
| 95 | 276 => 1,  | 
            ||
| 96 | 277 => 1,  | 
            ||
| 97 | 278 => 1,  | 
            ||
| 98 | 279 => 1,  | 
            ||
| 99 | 280 => 1,  | 
            ||
| 100 | 281 => 1,  | 
            ||
| 101 | 284 => 1,  | 
            ||
| 102 | 286 => 7,  | 
            ||
| 103 | 294 => 1,  | 
            ||
| 104 | 302 => 1,  | 
            ||
| 105 | 312 => 1,  | 
            ||
| 106 | 358 => 1,  | 
            ||
| 107 | 359 => 2,  | 
            ||
| 108 | 372 => 1,  | 
            ||
| 109 | 373 => 1,  | 
            ||
| 110 | 387 => 1,  | 
            ||
| 111 | 407 => 1,  | 
            ||
| 112 | 441 => 1,  | 
            ||
| 113 | 500 => 1,  | 
            ||
| 114 | 526 => 1,  | 
            ||
| 115 | 548 => 1,  | 
            ||
| 116 | 641 => 1,  | 
            ||
| 117 | 669 => 1,  | 
            ||
| 118 | 688 => 1,  | 
            ||
| 119 | 744 => 1,  | 
            ||
| 120 | 748 => 1,  | 
            ||
| 121 | 767 => 1,  | 
            ||
| 122 | 789 => 1,  | 
            ||
| 123 | 792 => 1,  | 
            ||
| 124 | 794 => 1,  | 
            ||
| 125 | 797 => 1,  | 
            ||
| 126 | 801 => 1,  | 
            ||
| 127 | 828 => 1,  | 
            ||
| 128 | 840 => 1,  | 
            ||
| 129 | 852 => 1,  | 
            ||
| 130 | 864 => 1,  | 
            ||
| 131 | 886 => 1,  | 
            ||
| 132 | 888 => 1,  | 
            ||
| 133 | 890 => 1,  | 
            ||
| 134 | 978 => 1,  | 
            ||
| 135 | 997 => 1,  | 
            ||
| 136 | );  | 
            ||
| 137 | |||
| 138 | // Scalar type hints only work from PHP 7 onwards.  | 
            ||
| 139 |             if (PHP_VERSION_ID >= 70000) { | 
            ||
| 140 | $errors[17] = 3;  | 
            ||
| 141 | $errors[128] = 1;  | 
            ||
| 142 | $errors[143] = 3;  | 
            ||
| 143 | $errors[161] = 2;  | 
            ||
| 144 | $errors[201] = 1;  | 
            ||
| 145 | $errors[232] = 7;  | 
            ||
| 146 | $errors[363] = 3;  | 
            ||
| 147 | $errors[377] = 1;  | 
            ||
| 148 | $errors[575] = 2;  | 
            ||
| 149 | $errors[627] = 1;  | 
            ||
| 150 | $errors[1002] = 1;  | 
            ||
| 151 |             } else { | 
            ||
| 152 | $errors[729] = 4;  | 
            ||
| 153 | $errors[740] = 2;  | 
            ||
| 154 | $errors[752] = 2;  | 
            ||
| 155 | $errors[982] = 1;  | 
            ||
| 156 | }  | 
            ||
| 157 | |||
| 158 | // Object type hints only work from PHP 7.2 onwards.  | 
            ||
| 159 |             if (PHP_VERSION_ID >= 70200) { | 
            ||
| 160 | $errors[627] = 2;  | 
            ||
| 161 |             } else { | 
            ||
| 162 | $errors[992] = 2;  | 
            ||
| 163 | }  | 
            ||
| 164 | |||
| 165 | // === New error types added over existing Squiz sniff ===.  | 
            ||
| 166 | |||
| 167 | // Short comment validation for non-In-Portal event methods.  | 
            ||
| 168 | $errors[6] = 1;  | 
            ||
| 169 | $errors[52] = 1;  | 
            ||
| 170 | $errors[110] = 1;  | 
            ||
| 171 | $errors[180] = 1;  | 
            ||
| 172 | // Reports "@throws" tag usage without exception being thrown inside a method.  | 
            ||
| 173 | $errors[15] += 1;  | 
            ||
| 174 | $errors[199] += 1;  | 
            ||
| 175 | $errors[669] += 1;  | 
            ||
| 176 | |||
| 177 | return $errors;  | 
            ||
| 178 |         } elseif ($testFile === 'FunctionCommentUnitTest.2.inc') { | 
            ||
| 179 | return array(  | 
            ||
| 180 | // Square bracket not allowed as function short description start.  | 
            ||
| 181 | 7 => 1,  | 
            ||
| 182 | |||
| 183 | // Square bracket is allowed as event short description start.  | 
            ||
| 184 | 17 => 0,  | 
            ||
| 185 | |||
| 186 | // Incorrect event short description start.  | 
            ||
| 187 | 27 => 1,  | 
            ||
| 188 | );  | 
            ||
| 189 |         } elseif ($testFile === 'FunctionCommentUnitTest.3.inc') { | 
            ||
| 190 | $errors = array(  | 
            ||
| 191 | // Square bracket not allowed as function short description start.  | 
            ||
| 192 | 7 => 1,  | 
            ||
| 193 | |||
| 194 | // Square bracket is allowed as event short description start.  | 
            ||
| 195 | 17 => 0,  | 
            ||
| 196 | |||
| 197 | // Incorrect event short description start.  | 
            ||
| 198 | 27 => 1,  | 
            ||
| 199 | );  | 
            ||
| 200 | |||
| 201 | return $errors;  | 
            ||
| 202 |         } elseif ($testFile === 'FunctionCommentUnitTest.4.inc') { | 
            ||
| 203 | $errors = array(  | 
            ||
| 204 | // Return type "$this" used instead of static/self.  | 
            ||
| 205 | 6 => 1,  | 
            ||
| 206 | );  | 
            ||
| 207 | |||
| 208 | // Scalar type hints only work from PHP 7 onwards.  | 
            ||
| 209 |             if (PHP_VERSION_ID >= 70000) { | 
            ||
| 210 | $errors[23] = 1;  | 
            ||
| 211 | $errors[38] = 1;  | 
            ||
| 212 | }  | 
            ||
| 213 | |||
| 214 | return $errors;  | 
            ||
| 215 | }//end if  | 
            ||
| 216 | |||
| 217 | return array();  | 
            ||
| 218 | }//end getErrorList()  | 
            ||
| 219 | |||
| 257 |