NearbySearchQuery::setTypes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Arthem\GoogleApi\Domain\Place\Query\Search;
4
5
use Arthem\GoogleApi\Domain\Place\VO\Location;
6
use Arthem\GoogleApi\Domain\Place\VO\PlaceName;
7
use Arthem\GoogleApi\Domain\Place\VO\Radius;
8
9
class NearbySearchQuery
10
{
11
    /**
12
     * @var Location
13
     */
14
    private $location;
15
16
    /**
17
     * @var Radius
18
     */
19
    private $radius;
20
21
    /**
22
     * @var PlaceName
23
     */
24
    private $name;
25
26
    /**
27
     * @var string
28
     */
29
    private $rankBy;
30
31
    /**
32
     * @var array
33
     */
34
    private $types = [];
35
36
    /**
37
     * @param float          $latitude
38
     * @param float          $longitude
39
     * @param int|float|null $radius
40
     * @param string|null    $name
41
     */
42
    public function __construct($latitude, $longitude, $radius = null, $name = null)
43
    {
44
        $this->location = new Location($latitude, $longitude);
45
        if (null !== $radius) {
46
            $this->radius = new Radius($radius);
47
        }
48
49
        if (!empty($name)) {
50
            $this->name = new PlaceName($name);
51
        }
52
    }
53
54
    /**
55
     * @return Location
56
     */
57
    public function getLocation()
58
    {
59
        return $this->location;
60
    }
61
62
    /**
63
     * @return Radius
64
     */
65
    public function getRadius()
66
    {
67
        return $this->radius;
68
    }
69
70
    /**
71
     * @return PlaceName
72
     */
73
    public function getName()
74
    {
75
        return $this->name;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getRankBy()
82
    {
83
        return $this->rankBy;
84
    }
85
86
    /**
87
     * @param string $rankBy
88
     * @return $this
89
     */
90
    public function setRankBy($rankBy)
91
    {
92
        $this->rankBy = $rankBy;
93
94
        return $this;
95
    }
96
97
    /**
98
     * @return array
99
     */
100
    public function getTypes()
101
    {
102
        return $this->types;
103
    }
104
105
    /**
106
     * @param array $types
107
     * @return $this
108
     */
109
    public function setTypes(array $types)
110
    {
111
        $this->types = $types;
112
113
        return $this;
114
    }
115
}
116