Completed
Push — master ( 965a67...27eb1e )
by Krzysztof
06:05 queued 03:13
created

IntegerRangeCriteria::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace KGzocha\Searcher\Criteria;
4
5
/**
6
 * @author Krzysztof Gzocha <[email protected]>
7
 */
8
class IntegerRangeCriteria implements CriteriaInterface
9
{
10
    /**
11
     * @var int
12
     */
13
    private $min;
14
15
    /**
16
     * @var int
17
     */
18
    private $max;
19
20
    /**
21
     * @param int $min
22
     * @param int $max
23
     */
24 4
    public function __construct($min = null, $max = null)
25
    {
26 4
        $this->min = $min;
27 4
        $this->max = $max;
28 4
    }
29
30
    /**
31
     * @return int
32
     */
33 1
    public function getMin()
34
    {
35 1
        return $this->min;
36
    }
37
38
    /**
39
     * @param int $min
40
     */
41 2
    public function setMin($min)
42
    {
43 2
        $this->min = (int) $min;
44 2
    }
45
46
    /**
47
     * @return int
48
     */
49 1
    public function getMax()
50
    {
51 1
        return $this->max;
52
    }
53
54
    /**
55
     * @param int $max
56
     */
57 2
    public function setMax($max)
58
    {
59 2
        $this->max = (int) $max;
60 2
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 2
    public function shouldBeApplied()
66
    {
67 2
        return $this->min !== null && $this->max !== null;
68
    }
69
}
70