| Conditions | 4 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 20 | public static function validate($iswc) |
||
| 21 | { |
||
| 22 | if (!((bool) preg_match('/^\s*T[\-.]?(\d)(\d)(\d)[\-.]?(\d)(\d)(\d)[\-.]?(\d)(\d)(\d)[\-.]?(\d)\s*$/i', $iswc))) { |
||
| 23 | return false; |
||
| 24 | } |
||
| 25 | $hyphens = ['‐', '-', '.']; |
||
| 26 | $iswc = parent::unDecorate($iswc, $hyphens); |
||
|
|
|||
| 27 | |||
| 28 | $sum = 1; |
||
| 29 | |||
| 30 | for ($i = 1; $i <= 9; ++$i) { |
||
| 31 | $sum = $sum + $i * (int) $iswc[$i]; |
||
| 32 | } |
||
| 33 | |||
| 34 | $rem = $sum % 10; |
||
| 35 | if ($rem !== 0) { |
||
| 36 | $rem = 10 - $rem; |
||
| 37 | } |
||
| 38 | |||
| 39 | return (int) $iswc[10] === $rem; |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
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.