1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Ivory Google Map package. |
5
|
|
|
* |
6
|
|
|
* (c) Eric GELOEN <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please read the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Ivory\GoogleMap\Service\Directions; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @author GeLo <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
class DirectionsGeocoded |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var string|null |
21
|
|
|
*/ |
22
|
|
|
private $status; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var bool|null |
26
|
|
|
*/ |
27
|
|
|
private $partialMatch; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string|null |
31
|
|
|
*/ |
32
|
|
|
private $placeId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string[] |
36
|
|
|
*/ |
37
|
|
|
private $types = []; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return bool |
41
|
|
|
*/ |
42
|
|
|
public function hasStatus() |
43
|
|
|
{ |
44
|
|
|
return $this->status !== null; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return string|null |
49
|
|
|
*/ |
50
|
|
|
public function getStatus() |
51
|
|
|
{ |
52
|
|
|
return $this->status; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param string|null $status |
57
|
|
|
*/ |
58
|
|
|
public function setStatus($status) |
59
|
|
|
{ |
60
|
|
|
$this->status = $status; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return bool |
65
|
|
|
*/ |
66
|
|
|
public function hasPartialMatch() |
67
|
|
|
{ |
68
|
|
|
return $this->partialMatch !== null; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return bool|null |
73
|
|
|
*/ |
74
|
|
|
public function isPartialMatch() |
75
|
|
|
{ |
76
|
|
|
return $this->partialMatch; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param bool|null $partialMatch |
81
|
|
|
*/ |
82
|
|
|
public function setPartialMatch($partialMatch) |
83
|
|
|
{ |
84
|
|
|
$this->partialMatch = $partialMatch; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return bool |
89
|
|
|
*/ |
90
|
|
|
public function hasPlaceId() |
91
|
|
|
{ |
92
|
|
|
return $this->placeId !== null; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return string|null |
97
|
|
|
*/ |
98
|
|
|
public function getPlaceId() |
99
|
|
|
{ |
100
|
|
|
return $this->placeId; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param string|null $placeId |
105
|
|
|
*/ |
106
|
|
|
public function setPlaceId($placeId) |
107
|
|
|
{ |
108
|
|
|
$this->placeId = $placeId; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @return bool |
113
|
|
|
*/ |
114
|
|
|
public function hasTypes() |
115
|
|
|
{ |
116
|
|
|
return !empty($this->types); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return string[] |
121
|
|
|
*/ |
122
|
|
|
public function getTypes() |
123
|
|
|
{ |
124
|
|
|
return $this->types; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @param string[] $types |
129
|
|
|
*/ |
130
|
|
|
public function setTypes(array $types) |
131
|
|
|
{ |
132
|
|
|
$this->types = []; |
133
|
|
|
$this->addTypes($types); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param string[] $types |
138
|
|
|
*/ |
139
|
|
|
public function addTypes(array $types) |
140
|
|
|
{ |
141
|
|
|
foreach ($types as $type) { |
142
|
|
|
$this->addType($type); |
143
|
|
|
} |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param string $type |
148
|
|
|
* |
149
|
|
|
* @return bool |
150
|
|
|
*/ |
151
|
|
|
public function hasType($type) |
152
|
|
|
{ |
153
|
|
|
return in_array($type, $this->types, true); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param string $type |
158
|
|
|
*/ |
159
|
|
|
public function addType($type) |
160
|
|
|
{ |
161
|
|
|
if (!$this->hasType($type)) { |
162
|
|
|
$this->types[] = $type; |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param string $type |
168
|
|
|
*/ |
169
|
|
|
public function removeType($type) |
170
|
|
|
{ |
171
|
|
|
unset($this->types[array_search($type, $this->types, true)]); |
172
|
|
|
$this->types = array_values($this->types); |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
|