Completed
Push — master ( afdd3e...7aa26d )
by Krzysztof
02:29
created

CoordinatesCriteria   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 63
ccs 17
cts 17
cp 1
rs 10

6 Methods

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