IntegerRangeCriteria   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

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
declare(strict_types=1);
3
4
namespace KGzocha\Searcher\Criteria;
5
6
/**
7
 * @author Krzysztof Gzocha <[email protected]>
8
 */
9
class IntegerRangeCriteria implements CriteriaInterface
10
{
11
    /**
12
     * @var int
13
     */
14
    private $min;
15
16
    /**
17
     * @var int
18
     */
19
    private $max;
20
21
    /**
22
     * @param int|null $min
23
     * @param int|null $max
24
     */
25 7
    public function __construct(int $min = null, int $max = null)
26
    {
27 7
        $this->min = $min;
28 7
        $this->max = $max;
29 7
    }
30
31
    /**
32
     * @return int|null
33
     */
34 1
    public function getMin()
35
    {
36 1
        return $this->min;
37
    }
38
39
    /**
40
     * @param int $min
41
     */
42 1
    public function setMin(int $min = null)
43
    {
44 1
        $this->min = $min;
45 1
    }
46
47
    /**
48
     * @return int
49
     */
50 1
    public function getMax()
51
    {
52 1
        return $this->max;
53
    }
54
55
    /**
56
     * @param int $max
57
     */
58 1
    public function setMax(int $max = null)
59
    {
60 1
        $this->max = $max;
61 1
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66 5
    public function shouldBeApplied(): bool
67
    {
68 5
        return $this->min !== null && $this->max !== null;
69
    }
70
}
71