| Conditions | 4 |
| Paths | 6 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 2 | private function validateLuhnAlgorithm($imei) |
|
| 43 | { |
||
| 44 | 2 | $str = ''; |
|
| 45 | |||
| 46 | 2 | foreach (str_split(strrev((string) $imei)) as $i => $d) { |
|
| 47 | 2 | $str .= $i %2 !== 0 ? $d * 2 : $d; |
|
| 48 | 2 | } |
|
| 49 | |||
| 50 | 2 | if (array_sum(str_split($str)) % 10 !== 0) { |
|
| 51 | 1 | throw new InvalidNativeArgumentException($imei, array('int (valid Imei code)')); |
|
| 52 | } |
||
| 53 | |||
| 54 | 1 | return $imei; |
|
| 55 | } |
||
| 56 | } |
||
| 57 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.