Completed
Push — master ( 27eb1e...afdd3e )
by Krzysztof
02:27
created

CoordinatesCriteria::getLatitude()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
ccs 0
cts 2
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace KGzocha\Searcher\Criteria;
4
5
/**
6
 * @author Krzysztof Gzocha <[email protected]>
7
 */
8
class CoordinatesCriteria implements CriteriaInterface
9
{
10
    /**
11
     * @var float
12
     */
13
    private $latitude;
14
15
    /**
16
     * @var float
17
     */
18
    private $longitude;
19
20
    /**
21
     * @param float $latitude
22
     * @param float $longitude
23
     */
24 6
    public function __construct($latitude = null, $longitude = null)
25
    {
26 6
        $this->latitude = $latitude;
27 6
        $this->longitude = $longitude;
28 6
    }
29
30
    /**
31
     * @return float
32
     */
33
    public function getLatitude()
34
    {
35
        return $this->latitude;
36
    }
37
38
    /**
39
     * @param float $latitude
40
     */
41
    public function setLatitude($latitude)
42
    {
43
        $this->latitude = (float) $latitude;
44
    }
45
46
    /**
47
     * @return float
48
     */
49
    public function getLongitude()
50
    {
51
        return $this->longitude;
52
    }
53
54
    /**
55
     * @param float $longitude
56
     */
57
    public function setLongitude($longitude)
58
    {
59
        $this->longitude = (float) $longitude;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 5
    public function shouldBeApplied()
66
    {
67 5
        return $this->latitude !== null
68 5
            && $this->longitude !== null;
69
    }
70
}
71