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

IntegerCriteria::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace KGzocha\Searcher\Criteria;
4
5
/**
6
 * @author Krzysztof Gzocha <[email protected]>
7
 */
8
class IntegerCriteria implements CriteriaInterface
9
{
10
    /**
11
     * @var int
12
     */
13
    private $integer;
14
15
    /**
16
     * @param int $integer
17
     */
18 4
    public function __construct($integer = null)
19
    {
20 4
        $this->integer = $integer;
21 4
    }
22
23
    /**
24
     * @return int
25
     */
26 1
    public function getInteger()
27
    {
28 1
        return $this->integer;
29
    }
30
31
    /**
32
     * @param int $integer
33
     */
34 2
    public function setInteger($integer)
35
    {
36 2
        $this->integer = (int) $integer;
37 2
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 2
    public function shouldBeApplied()
43
    {
44 2
        return $this->integer !== null;
45
    }
46
}
47