Code Duplication    Length = 10-10 lines in 4 locations

benchmark/Result/Result.php 2 locations

@@ 38-47 (lines=10) @@
35
        return $this->hasSolution;
36
    }
37
38
    private function filterSize($size)
39
    {
40
        $naturalNumber = filter_var($size, FILTER_VALIDATE_INT, array('options' => array('min_range' => 1)));
41
42
        if ($naturalNumber === false) {
43
            throw new \InvalidArgumentException('Invalid size: ' . print_r($size, true));
44
        }
45
46
        return $naturalNumber;
47
    }
48
49
    private function filterDuration($duration)
50
    {
@@ 49-58 (lines=10) @@
46
        return $naturalNumber;
47
    }
48
49
    private function filterDuration($duration)
50
    {
51
        $nonNegativeInteger = filter_var($duration, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0)));
52
53
        if ($nonNegativeInteger === false) {
54
            throw new \InvalidArgumentException('Invalid duration: ' . print_r($duration, true));
55
        }
56
57
        return $nonNegativeInteger;
58
    }
59
60
    private function filterHasSolution($hasSolution)
61
    {

examples/Terrain/MyNode.php 1 location

@@ 55-64 (lines=10) @@
52
        return $this->row . 'x' . $this->column;
53
    }
54
55
    private function filterNonNegativeInteger($value)
56
    {
57
        $nonNegativeInteger = filter_var($value, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0)));
58
59
        if ($nonNegativeInteger === false) {
60
            throw new \InvalidArgumentException('Invalid non negative integer: ' . print_r($value, true));
61
        }
62
63
        return $nonNegativeInteger;
64
    }
65
}
66

examples/Terrain/SequencePrinter.php 1 location

@@ 54-63 (lines=10) @@
51
    /**
52
     * @param int $tileSize
53
     */
54
    public function setTileSize($tileSize)
55
    {
56
        $naturalNumber = filter_var($tileSize, FILTER_VALIDATE_INT, array('options' => array('min_range' => 1)));
57
58
        if ($naturalNumber === false) {
59
            throw new \InvalidArgumentException('Invalid tile size: ' . print_r($tileSize, true));
60
        }
61
62
        $this->tileSize = $naturalNumber;
63
    }
64
65
    /**
66
     * @return string