src/Modulo10Gtin.php 1 location
|
@@ 36-38 (lines=3) @@
|
| 33 |
|
$weight = 3; |
| 34 |
|
$sum = 0; |
| 35 |
|
|
| 36 |
|
foreach (array_reverse(str_split($number)) as $pos => $digit) { |
| 37 |
|
$sum += $digit * ($pos % 2 ? 1 : $weight); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
$ceil = $sum; |
| 41 |
|
|
src/Modulo11.php 1 location
|
@@ 67-69 (lines=3) @@
|
| 64 |
|
|
| 65 |
|
$sum = 0; |
| 66 |
|
|
| 67 |
|
foreach (array_reverse(str_split($number)) as $pos => $digit) { |
| 68 |
|
$sum += $digit * $this->getWeight($pos, 2); |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
// Calculate check digit from remainder |
| 72 |
|
return self::$remainderToCheck[11 - $sum % 11]; |