Code Duplication    Length = 3-3 lines in 2 locations

src/Modulo10Gtin.php 1 location

@@ 16-18 (lines=3) @@
13
    {
14
        $sum = 0;
15
16
        foreach (array_reverse(str_split($number)) as $pos => $digit) {
17
            $sum += $digit * ($pos % 2 ? 1 : 3);
18
        }
19
20
        return $sum;
21
    }

src/Modulo11.php 1 location

@@ 63-65 (lines=3) @@
60
61
        $sum = 0;
62
63
        foreach (array_reverse(str_split($number)) as $pos => $digit) {
64
            $sum += $digit * $this->getWeight($pos, 2);
65
        }
66
67
        // Calculate check digit from remainder
68
        return self::$remainderToCheck[11 - $sum % 11];