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

NumberCriteria::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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
    public function __construct($number = null)
19
    {
20
        $this->number = $number;
21
    }
22
23
    /**
24
     * @return float
25
     */
26
    public function getNumber()
27
    {
28
        return $this->number;
29
    }
30
31
    /**
32
     * @param float $number
33
     */
34
    public function setNumber($number)
35
    {
36
        $this->number = (float) $number;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function shouldBeApplied()
43
    {
44
        return $this->number !== null
45
            && is_float($this->number);
46
    }
47
}
48