| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public static function validate($grai) |
||
| 21 | { |
||
| 22 | if (strlen($grai) < 13) { |
||
| 23 | return false; |
||
| 24 | } |
||
| 25 | $grai = self::unDecorate($grai); |
||
| 26 | if (0 !== (int) $grai[0]) { |
||
| 27 | return false; |
||
| 28 | } |
||
| 29 | $grai = substr($grai, 1, strlen($grai) - 1); |
||
| 30 | if (strlen($grai) > 29) { |
||
| 31 | return false; |
||
| 32 | } |
||
| 33 | $gtin13 = substr($grai, 0, 13); |
||
| 34 | if (!ctype_alnum(substr($grai, 13, strlen($grai)))) { |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | return parent::check($gtin13, 13); // optional serial component not to be checked |
||
|
|
|||
| 39 | } |
||
| 40 | } |
||
| 41 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.