|
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\Place\Detail\Response; |
|
13
|
|
|
|
|
14
|
|
|
use Ivory\GoogleMap\Service\Place\Base\Place; |
|
15
|
|
|
use Ivory\GoogleMap\Service\Place\Detail\Request\PlaceDetailRequestInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @author GeLo <[email protected]> |
|
19
|
|
|
*/ |
|
20
|
|
|
class PlaceDetailResponse |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var string|null |
|
24
|
|
|
*/ |
|
25
|
|
|
private $status; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var PlaceDetailRequestInterface|null |
|
29
|
|
|
*/ |
|
30
|
|
|
private $request; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var Place|null |
|
34
|
|
|
*/ |
|
35
|
|
|
private $result; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var string[] |
|
39
|
|
|
*/ |
|
40
|
|
|
private $htmlAttributions = []; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @return bool |
|
44
|
|
|
*/ |
|
45
|
|
|
public function hasStatus() |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->status !== null; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @return string|null |
|
52
|
|
|
*/ |
|
53
|
|
|
public function getStatus() |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->status; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @param string|null $status |
|
60
|
|
|
*/ |
|
61
|
|
|
public function setStatus($status) |
|
62
|
|
|
{ |
|
63
|
|
|
$this->status = $status; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return bool |
|
68
|
|
|
*/ |
|
69
|
|
|
public function hasRequest() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->request !== null; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return PlaceDetailRequestInterface|null |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getRequest() |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->request; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @param PlaceDetailRequestInterface|null $request |
|
84
|
|
|
*/ |
|
85
|
|
|
public function setRequest(PlaceDetailRequestInterface $request = null) |
|
86
|
|
|
{ |
|
87
|
|
|
$this->request = $request; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return bool |
|
92
|
|
|
*/ |
|
93
|
|
|
public function hasResult() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->result !== null; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return Place|null |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getResult() |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->result; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @param Place|null $result |
|
108
|
|
|
*/ |
|
109
|
|
|
public function setResult(Place $result = null) |
|
110
|
|
|
{ |
|
111
|
|
|
$this->result = $result; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @return bool |
|
116
|
|
|
*/ |
|
117
|
|
|
public function hasHtmlAttributions() |
|
118
|
|
|
{ |
|
119
|
|
|
return !empty($this->htmlAttributions); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @return string[] |
|
124
|
|
|
*/ |
|
125
|
|
|
public function getHtmlAttributions() |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->htmlAttributions; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* @param string[] $htmlAttributions |
|
132
|
|
|
*/ |
|
133
|
|
|
public function setHtmlAttributions(array $htmlAttributions) |
|
134
|
|
|
{ |
|
135
|
|
|
$this->htmlAttributions = []; |
|
136
|
|
|
$this->addHtmlAttributions($htmlAttributions); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @param string[] $htmlAttributions |
|
141
|
|
|
*/ |
|
142
|
|
|
public function addHtmlAttributions(array $htmlAttributions) |
|
143
|
|
|
{ |
|
144
|
|
|
foreach ($htmlAttributions as $htmlAttribution) { |
|
145
|
|
|
$this->addHtmlAttribution($htmlAttribution); |
|
146
|
|
|
} |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @param string $htmlAttribution |
|
151
|
|
|
* |
|
152
|
|
|
* @return bool |
|
153
|
|
|
*/ |
|
154
|
|
|
public function hasHtmlAttribution($htmlAttribution) |
|
155
|
|
|
{ |
|
156
|
|
|
return in_array($htmlAttribution, $this->htmlAttributions, true); |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @param string $htmlAttribution |
|
161
|
|
|
*/ |
|
162
|
|
|
public function addHtmlAttribution($htmlAttribution) |
|
163
|
|
|
{ |
|
164
|
|
|
if (!$this->hasHtmlAttribution($htmlAttribution)) { |
|
165
|
|
|
$this->htmlAttributions[] = $htmlAttribution; |
|
166
|
|
|
} |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @param string $htmlAttribution |
|
171
|
|
|
*/ |
|
172
|
|
|
public function removeHtmlAttribution($htmlAttribution) |
|
173
|
|
|
{ |
|
174
|
|
|
unset($this->htmlAttributions[array_search($htmlAttribution, $this->htmlAttributions, true)]); |
|
175
|
|
|
$this->htmlAttributions = array_values($this->htmlAttributions); |
|
176
|
|
|
} |
|
177
|
|
|
} |
|
178
|
|
|
|