Code Duplication    Length = 37-38 lines in 2 locations

src/Rules/Max.php 1 location

@@ 19-56 (lines=38) @@
16
/**
17
 * Check if value is above a maximum.
18
 */
19
class Max implements RuleInterface
20
{
21
    /**
22
     * @var mixed Received value.
23
     */
24
    private $received;
25
    
26
    /**
27
     * @var mixed Max expected value.
28
     */
29
    private $max;
30
31
    /**
32
     * Class constructor.
33
     *
34
     * @param mixed $received
35
     * @param mixed $max
36
     */
37
    public function __construct($received, $max)
38
    {
39
        $this->received = $received;
40
        $this->max = $max;
41
    }
42
43
    /**
44
     * Test.
45
     *
46
     * @return bool
47
     */
48
    public function test(): bool
49
    {
50
        if ($this->received > $this->max) {
51
            return true;
52
        }
53
54
        return false;
55
    }
56
}
57

src/Rules/Min.php 1 location

@@ 19-55 (lines=37) @@
16
/**
17
 * Check if value is below a minum.
18
 */
19
class Min implements RuleInterface
20
{
21
    /**
22
     * @var mixed Received value.
23
     */
24
    private $received;
25
    
26
    /**
27
     * @var mixed Min expected value.
28
     */
29
    private $min;
30
31
    /**
32
     *
33
     * @param mixed $received
34
     * @param mixed $min
35
     */
36
    public function __construct($received, $min)
37
    {
38
        $this->received = $received;
39
        $this->min = $min;
40
    }
41
42
    /**
43
     * Test.
44
     *
45
     * @return bool
46
     */
47
    public function test(): bool
48
    {
49
        if ($this->received < $this->min) {
50
            return true;
51
        }
52
53
        return false;
54
    }
55
}
56