Code Duplication    Length = 6-7 lines in 3 locations

src/Calculation/Maximum.php 1 location

@@ 20-26 (lines=7) @@
17
    {
18
        $maximum = 0;
19
20
        for ($y = 0; $y < $height; $y++) {
21
            for ($x = 0; $x < $width; $x++) {
22
                if ($bitmap[$y][$x] > $maximum) {
23
                    $maximum = $bitmap[$y][$x];
24
                }
25
            }
26
        }
27
28
        return (float) $maximum;
29
    }

src/Calculation/StandardDeviation.php 1 location

@@ 21-26 (lines=6) @@
18
    {
19
        $standardDeviation = 0;
20
21
        for ($y = 0; $y < $height; $y++) {
22
            for ($x = 0; $x < $width; $x++) {
23
                $delta = $map[$y][$x] - $average;
24
                $standardDeviation += ($delta * $delta);
25
            }
26
        }
27
28
        $standardDeviation /= (($width * $height) - 1);
29
        $standardDeviation = sqrt($standardDeviation);

src/Transformation/ReducedStandardDeviation.php 1 location

@@ 21-27 (lines=7) @@
18
    {
19
        $new = array_slice($bitmap, 0);
20
21
        for ($y = 0; $y < $height; $y++) {
22
            for ($x = 0; $x < $width; $x++) {
23
                if (abs($new[$y][$x]) < $deviation) {
24
                    $new[$y][$x] = 0;
25
                }
26
            }
27
        }
28
29
        return $new;
30
    }