Completed
Push — master ( afdd3e...7aa26d )
by Krzysztof
02:29
created

NumberCriteria::getNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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