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

IntegerRangeCriteria   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 62
ccs 16
cts 16
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getMin() 0 4 1
A setMin() 0 4 1
A getMax() 0 4 1
A setMax() 0 4 1
A shouldBeApplied() 0 4 2
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