Completed
Pull Request — master (#46)
by Daniel
03:48
created

CoordinatesQueryCriteria   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 69.23%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 53
ccs 9
cts 13
cp 0.6923
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getLatitude() 0 4 1
A setLatitude() 0 4 1
A getLongitude() 0 4 1
A setLongitude() 0 4 1
A shouldBeApplied() 0 5 2
1
<?php
2
3
namespace KGzocha\Searcher\QueryCriteria;
4
5
/**
6
 * @author Krzysztof Gzocha <[email protected]>
7
 * @package KGzocha\Searcher\FilterModel
8
 */
9
class CoordinatesQueryCriteria implements QueryCriteriaInterface
10
{
11
    /**
12
     * @var float
13
     */
14
    private $latitude;
15
16
    /**
17
     * @var float
18
     */
19
    private $longitude;
20
21
    /**
22
     * @return float
23
     */
24
    public function getLatitude()
25
    {
26
        return $this->latitude;
27
    }
28
29
    /**
30
     * @param float $latitude
31
     */
32 1
    public function setLatitude($latitude)
33
    {
34 1
        $this->latitude = (float) $latitude;
35 1
    }
36
37
    /**
38
     * @return float
39
     */
40
    public function getLongitude()
41
    {
42
        return $this->longitude;
43
    }
44
45
    /**
46
     * @param float $longitude
47
     */
48 1
    public function setLongitude($longitude)
49
    {
50 1
        $this->longitude = (float) $longitude;
51 1
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56 2
    public function shouldBeApplied()
57
    {
58 2
        return $this->latitude !== null
59 2
            && $this->longitude !== null;
60
    }
61
}
62