This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
64
1
$sum += $digit * $this->getWeight($pos, 2);
65
}
66
67
// Calculate check digit from remainder
68
1
return self::$remainderToCheck[11 - $sum % 11];
69
}
70
71
/**
72
* Calculate weight based on position in number
73
*
74
* @param int $pos Position in number (starts from 0)
75
* @param int $start Start value for weight calculation (value of position 0)
76
*/
77
2
protected function getWeight(int $pos, int $start = 1): int
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.