Completed
Push — master ( 3485f9...8fe415 )
by Koldo
14:45
created

AbstractRange::getMax()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of InFw\Range package.
5
 */
6
7
namespace InFw\Range;
8
9
/**
10
 * Class AbstractRange.
11
 */
12
abstract class AbstractRange implements RangeInterface
13
{
14
    /**
15
     * Range minimum value.
16
     *
17
     * @var int
18
     */
19
    private $min;
20
21
    /**
22
     * Range maximum value.
23
     *
24
     * @var int
25
     */
26
    private $max;
27
28
    /**
29
     * Range constructor.
30
     *
31
     * @param int $min
32
     * @param int $max
33
     */
34
    public function __construct($min, $max)
35
    {
36
        if (
37
            2 !== count(array_filter([$min, $max], function ($value) {
38
                return true === is_int($value);
39
            }))
40
        ) {
41
            throw new \InvalidArgumentException(
42
                'All parameters at Size object must be integers.'
43
            );
44
        }
45
46
        $this->min = $min;
47
        $this->max = $max;
48
    }
49
50
    /**
51
     * Get Range min value.
52
     *
53
     * @return int
54
     */
55
    public function getMin()
56
    {
57
        return $this->min;
58
    }
59
60
    /**
61
     * Get Range max value.
62
     *
63
     * @return int
64
     */
65
    public function getMax()
66
    {
67
        return $this->max;
68
    }
69
}
70