CoordinatesCriteria   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

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
declare(strict_types=1);
3
4
namespace KGzocha\Searcher\Criteria;
5
6
/**
7
 * @author Krzysztof Gzocha <[email protected]>
8
 */
9
class CoordinatesCriteria implements CriteriaInterface
10
{
11
    /**
12
     * @var float
13
     */
14
    private $latitude;
15
16
    /**
17
     * @var float
18
     */
19
    private $longitude;
20
21
    /**
22
     * @param float $latitude
23
     * @param float $longitude
24
     */
25 8
    public function __construct(float $latitude = null, float $longitude = null)
26
    {
27 8
        $this->latitude = $latitude;
28 8
        $this->longitude = $longitude;
29 8
    }
30
31
    /**
32
     * @return float|null
33
     */
34 2
    public function getLatitude()
35
    {
36 2
        return $this->latitude;
37
    }
38
39
    /**
40
     * @param float $latitude
41
     */
42 2
    public function setLatitude(float $latitude = null)
43
    {
44 2
        $this->latitude = $latitude;
45 2
    }
46
47
    /**
48
     * @return float|null
49
     */
50 2
    public function getLongitude()
51
    {
52 2
        return $this->longitude;
53
    }
54
55
    /**
56
     * @param float $longitude
57
     */
58 2
    public function setLongitude(float $longitude = null)
59
    {
60 2
        $this->longitude = $longitude;
61 2
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66 5
    public function shouldBeApplied(): bool
67
    {
68 5
        return $this->latitude !== null
69 5
            && $this->longitude !== null;
70
    }
71
}
72