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

CoordinatesCriteria::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
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 3
    public function __construct($latitude = null, $longitude = null)
25
    {
26 3
        $this->latitude = $latitude;
27 3
        $this->longitude = $longitude;
28 3
    }
29
30
    /**
31
     * @return float
32
     */
33 1
    public function getLatitude()
34
    {
35 1
        return $this->latitude;
36
    }
37
38
    /**
39
     * @param float $latitude
40
     */
41 1
    public function setLatitude($latitude)
42
    {
43 1
        $this->latitude = (float) $latitude;
44 1
    }
45
46
    /**
47
     * @return float
48
     */
49 1
    public function getLongitude()
50
    {
51 1
        return $this->longitude;
52
    }
53
54
    /**
55
     * @param float $longitude
56
     */
57 1
    public function setLongitude($longitude)
58
    {
59 1
        $this->longitude = (float) $longitude;
60 1
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 2
    public function shouldBeApplied()
66
    {
67 2
        return $this->latitude !== null
68 2
            && $this->longitude !== null;
69
    }
70
}
71