Completed
Push — master ( 22cfbb...0f305f )
by Krzysztof
8s
created

CoordinatesCriteria   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

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 13
cts 13
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setLatitude() 0 4 1
A setLongitude() 0 4 1
A shouldBeApplied() 0 5 2
A getLatitude() 0 4 1
A getLongitude() 0 4 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
     * @return float
22
     */
23 1
    public function getLatitude()
24
    {
25 1
        return $this->latitude;
26
    }
27
28
    /**
29
     * @param float $latitude
30
     */
31 1
    public function setLatitude($latitude)
32
    {
33 1
        $this->latitude = (float) $latitude;
34 1
    }
35
36
    /**
37
     * @return float
38
     */
39 1
    public function getLongitude()
40
    {
41 1
        return $this->longitude;
42
    }
43
44
    /**
45
     * @param float $longitude
46
     */
47 1
    public function setLongitude($longitude)
48
    {
49 1
        $this->longitude = (float) $longitude;
50 1
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55 2
    public function shouldBeApplied()
56
    {
57 2
        return $this->latitude !== null
58 2
            && $this->longitude !== null;
59
    }
60
}
61