Completed
Pull Request — master (#46)
by Daniel
03:48
created

IntegerRangeQueryCriteria   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 52
ccs 12
cts 12
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
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\QueryCriteria;
4
5
/**
6
 * @author Krzysztof Gzocha <[email protected]>
7
 * @package KGzocha\Searcher\FilterModel
8
 */
9
class IntegerRangeQueryCriteria implements QueryCriteriaInterface
10
{
11
    /**
12
     * @var int
13
     */
14
    private $min;
15
16
    /**
17
     * @var int
18
     */
19
    private $max;
20
21
    /**
22
     * @return int
23
     */
24 1
    public function getMin()
25
    {
26 1
        return $this->min;
27
    }
28
29
    /**
30
     * @param int $min
31
     */
32 2
    public function setMin($min)
33
    {
34 2
        $this->min = (int) $min;
35 2
    }
36
37
    /**
38
     * @return int
39
     */
40 1
    public function getMax()
41
    {
42 1
        return $this->max;
43
    }
44
45
    /**
46
     * @param int $max
47
     */
48 2
    public function setMax($max)
49
    {
50 2
        $this->max = (int) $max;
51 2
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56 2
    public function shouldBeApplied()
57
    {
58 2
        return $this->min !== null && $this->max !== null;
59
    }
60
}
61