Conditions | 3 |
Paths | 2 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public static function validate($uid) |
||
24 | { |
||
25 | $multipliers = [5, 4, 3, 2, 7, 6, 5, 4]; |
||
26 | $result = 0; |
||
|
|||
27 | $uid = Utils::unDecorate(strval($uid), self::HYPHENS); |
||
28 | |||
29 | if (false !== strpos($uid, 'CHE', 0) || false !== strpos($uid, 'ADM', 0)) { |
||
30 | $uid = substr(strval($uid), 3, 9); |
||
31 | } |
||
32 | |||
33 | $uid = substr($uid, 0, 9); |
||
34 | |||
35 | return Utils::LuhnWithWeights($uid, 9, $multipliers, 11, self::HYPHENS); |
||
36 | } |
||
37 | } |
||
38 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.