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

IntegerCriteria   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getInteger() 0 4 1
A setInteger() 0 4 1
A shouldBeApplied() 0 4 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