@@ -127,7 +127,7 @@ |
||
| 127 | 127 | $error_message = $array_response[GoogleMapsResponseFields::ERROR_MESSAGE]; |
| 128 | 128 | $this->setErrorMessage($error_message); |
| 129 | 129 | } elseif (!empty($array_response[GoogleMapsResponseFields::STATUS])) { |
| 130 | - $error_message .= ': ' . $array_response[GoogleMapsResponseFields::STATUS]; |
|
| 130 | + $error_message .= ': '.$array_response[GoogleMapsResponseFields::STATUS]; |
|
| 131 | 131 | $this->setErrorMessage($error_message); |
| 132 | 132 | } |
| 133 | 133 | throw new RequestException($error_message); |
@@ -23,341 +23,341 @@ |
||
| 23 | 23 | class GoogleMapsResponse |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var Response |
|
| 28 | - */ |
|
| 29 | - protected $response = null; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Single result |
|
| 33 | - * When the Places service returns results from a details request, it places them within a single result |
|
| 34 | - * |
|
| 35 | - * @var array |
|
| 36 | - * @see https://developers.google.com/places/web-service/details#PlaceDetailsResults |
|
| 37 | - */ |
|
| 38 | - protected $result = null; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * contains an array of places, with information about each. |
|
| 42 | - * The Places API returns up to 20 establishment results per query. |
|
| 43 | - * Additionally, political results may be returned which serve to identify the area of the request. |
|
| 44 | - * |
|
| 45 | - * @var array |
|
| 46 | - * @see https://developers.google.com/places/web-service/search#PlaceSearchResults |
|
| 47 | - */ |
|
| 48 | - protected $results = null; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * contains metadata on the request. |
|
| 52 | - * |
|
| 53 | - * @var string |
|
| 54 | - * @see https://developers.google.com/places/web-service/search#PlaceSearchStatusCodes |
|
| 55 | - */ |
|
| 56 | - protected $status = null; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @var string |
|
| 60 | - */ |
|
| 61 | - protected $error_message = null; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * @var array |
|
| 65 | - */ |
|
| 66 | - protected $array_response = null; |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @var null|array |
|
| 70 | - */ |
|
| 71 | - protected $http_status_code = null; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * may contain a set of attributions about this listing which must be displayed to the user (some listings may not have attribution). |
|
| 75 | - * |
|
| 76 | - * @var null|array |
|
| 77 | - * @since 0.5.0 |
|
| 78 | - */ |
|
| 79 | - protected $html_attributions = null; |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * @var null|string |
|
| 83 | - * @since 0.5.0 |
|
| 84 | - */ |
|
| 85 | - protected $next_page_token = null; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * GoogleMapsResponse constructor. |
|
| 89 | - * |
|
| 90 | - * @param Response $response |
|
| 91 | - */ |
|
| 92 | - public function __construct(Response $response) |
|
| 93 | - { |
|
| 94 | - |
|
| 95 | - $this->setResponse($response); |
|
| 96 | - |
|
| 97 | - $this->parseResponse(); |
|
| 98 | - |
|
| 99 | - $this->checkHttpStatusCode(); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @param Response $response |
|
| 104 | - * |
|
| 105 | - * @return GoogleMapsResponse |
|
| 106 | - */ |
|
| 107 | - public function setResponse(Response $response): GoogleMapsResponse |
|
| 108 | - { |
|
| 109 | - |
|
| 110 | - $this->response = $response; |
|
| 111 | - |
|
| 112 | - return $this; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * @return GoogleMapsResponse |
|
| 117 | - * |
|
| 118 | - * @throws RequestException |
|
| 119 | - * @throws ResponseException |
|
| 120 | - */ |
|
| 121 | - protected function parseResponse(): GoogleMapsResponse |
|
| 122 | - { |
|
| 123 | - |
|
| 124 | - $json_response = $this->response->getBody()->getContents(); |
|
| 125 | - $array_response = $this->toArray($json_response); |
|
| 126 | - $result = null; |
|
| 127 | - $results = null; |
|
| 128 | - |
|
| 129 | - if (empty($array_response[GoogleMapsResponseFields::STATUS])) { |
|
| 130 | - throw new ResponseException('Missing "status" in GoogleMapsApi Response'); |
|
| 131 | - } |
|
| 132 | - $this->setStatus($array_response[GoogleMapsResponseFields::STATUS]); |
|
| 133 | - |
|
| 134 | - if ($this->getStatus() != GoogleMapsResponseStatusValues::OK) { |
|
| 135 | - $error_message = 'Something went wrong'; |
|
| 136 | - if (!empty($array_response[GoogleMapsResponseFields::ERROR_MESSAGE])) { |
|
| 137 | - $error_message = $array_response[GoogleMapsResponseFields::ERROR_MESSAGE]; |
|
| 138 | - $this->setErrorMessage($error_message); |
|
| 139 | - } elseif (!empty($array_response[GoogleMapsResponseFields::STATUS])) { |
|
| 140 | - $error_message .= ': ' . $array_response[GoogleMapsResponseFields::STATUS]; |
|
| 141 | - $this->setErrorMessage($error_message); |
|
| 142 | - } |
|
| 143 | - throw new RequestException($error_message); |
|
| 144 | - |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - if (!empty($array_response[GoogleMapsResponseFields::RESULTS])) { |
|
| 148 | - $results = $array_response[GoogleMapsResponseFields::RESULTS]; |
|
| 149 | - |
|
| 150 | - } elseif (!empty($array_response[GoogleMapsResponseFields::CANDIDATES])) { |
|
| 151 | - $results = $array_response[GoogleMapsResponseFields::CANDIDATES]; |
|
| 152 | - |
|
| 153 | - }elseif (!empty($array_response[GoogleMapsResponseFields::RESULT])) { |
|
| 154 | - $result = $array_response[GoogleMapsResponseFields::RESULT]; |
|
| 155 | - |
|
| 156 | - } else { |
|
| 157 | - $result = $array_response; |
|
| 158 | - } |
|
| 159 | - $this->setResult($result); |
|
| 160 | - $this->setResults($results); |
|
| 161 | - |
|
| 162 | - if (!empty($array_response[GoogleMapsResponseFields::HTML_ATTRIBUTIONS])) { |
|
| 163 | - $this->setHtmlAttributions($array_response[GoogleMapsResponseFields::HTML_ATTRIBUTIONS]); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - if (!empty($array_response[GoogleMapsResponseFields::NEXT_PAGE_TOKEN])) { |
|
| 167 | - $this->setNextPageToken($array_response[GoogleMapsResponseFields::NEXT_PAGE_TOKEN]); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - return $this; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @param string $json_response |
|
| 175 | - * |
|
| 176 | - * @return array |
|
| 177 | - */ |
|
| 178 | - public function toArray(string $json_response): array |
|
| 179 | - { |
|
| 180 | - |
|
| 181 | - $this->array_response = json_decode($json_response, true); |
|
| 182 | - |
|
| 183 | - return $this->array_response; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * @return string |
|
| 188 | - */ |
|
| 189 | - public function getStatus(): string |
|
| 190 | - { |
|
| 191 | - |
|
| 192 | - return $this->status; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * @param string $status |
|
| 197 | - * |
|
| 198 | - * @return GoogleMapsResponse |
|
| 199 | - */ |
|
| 200 | - public function setStatus(string $status) |
|
| 201 | - { |
|
| 202 | - |
|
| 203 | - $this->status = $status; |
|
| 204 | - |
|
| 205 | - return $this; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * Check HTTP status code (silent/No exceptions!) |
|
| 210 | - * @return int |
|
| 211 | - */ |
|
| 212 | - protected function checkHttpStatusCode(): int |
|
| 213 | - { |
|
| 214 | - |
|
| 215 | - $this->http_status_code = $this->response->getStatusCode(); |
|
| 216 | - |
|
| 217 | - return $this->http_status_code; |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - /** |
|
| 221 | - * @return array |
|
| 222 | - */ |
|
| 223 | - public function getResults() |
|
| 224 | - { |
|
| 225 | - |
|
| 226 | - return $this->results; |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * @param array $results |
|
| 231 | - * |
|
| 232 | - * @return $this |
|
| 233 | - */ |
|
| 234 | - public function setResults(?array $results) |
|
| 235 | - { |
|
| 236 | - |
|
| 237 | - $this->results = $results; |
|
| 238 | - |
|
| 239 | - return $this; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * @return array |
|
| 244 | - * @since v0.6.0 |
|
| 245 | - */ |
|
| 246 | - public function getResult() |
|
| 247 | - { |
|
| 248 | - |
|
| 249 | - return $this->result; |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - /** |
|
| 253 | - * @param array $result |
|
| 254 | - * |
|
| 255 | - * @return $this |
|
| 256 | - * @since v0.6.0 |
|
| 257 | - */ |
|
| 258 | - public function setResult(?array $result) |
|
| 259 | - { |
|
| 260 | - |
|
| 261 | - $this->result = $result; |
|
| 262 | - |
|
| 263 | - return $this; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * @return array |
|
| 268 | - */ |
|
| 269 | - public function getArrayResponse(): array |
|
| 270 | - { |
|
| 271 | - |
|
| 272 | - return $this->array_response; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * @param array $array_response |
|
| 277 | - * |
|
| 278 | - * @return GoogleMapsResponse |
|
| 279 | - */ |
|
| 280 | - public function setArrayResponse(array $array_response): GoogleMapsResponse |
|
| 281 | - { |
|
| 282 | - |
|
| 283 | - $this->array_response = $array_response; |
|
| 284 | - |
|
| 285 | - return $this; |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * @return mixed |
|
| 290 | - */ |
|
| 291 | - public function getErrorMessage() |
|
| 292 | - { |
|
| 293 | - |
|
| 294 | - return $this->error_message; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - /** |
|
| 298 | - * @param $error_message |
|
| 299 | - * |
|
| 300 | - * @return GoogleMapsResponse |
|
| 301 | - */ |
|
| 302 | - public function setErrorMessage($error_message): GoogleMapsResponse |
|
| 303 | - { |
|
| 304 | - |
|
| 305 | - $this->error_message = $error_message; |
|
| 306 | - |
|
| 307 | - return $this; |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - /** |
|
| 311 | - * @return int |
|
| 312 | - */ |
|
| 313 | - public function getHttpStatusCode(): int |
|
| 314 | - { |
|
| 315 | - |
|
| 316 | - return intval($this->http_status_code); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - /** |
|
| 320 | - * @return array|null |
|
| 321 | - */ |
|
| 322 | - public function getHtmlAttributions(): ?array |
|
| 323 | - { |
|
| 324 | - |
|
| 325 | - return $this->html_attributions; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - /** |
|
| 329 | - * @param array|null $html_attributions |
|
| 330 | - * |
|
| 331 | - * @return GoogleMapsResponse |
|
| 332 | - */ |
|
| 333 | - public function setHtmlAttributions(?array $html_attributions): GoogleMapsResponse |
|
| 334 | - { |
|
| 335 | - |
|
| 336 | - $this->html_attributions = $html_attributions; |
|
| 337 | - |
|
| 338 | - return $this; |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * @return string |
|
| 343 | - */ |
|
| 344 | - public function getNextPageToken(): string |
|
| 345 | - { |
|
| 346 | - |
|
| 347 | - return $this->next_page_token ?? ''; |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * @param $next_page_token |
|
| 352 | - * |
|
| 353 | - * @return GoogleMapsResponse |
|
| 354 | - */ |
|
| 355 | - public function setNextPageToken($next_page_token): GoogleMapsResponse |
|
| 356 | - { |
|
| 357 | - |
|
| 358 | - $this->next_page_token = $next_page_token; |
|
| 359 | - |
|
| 360 | - return $this; |
|
| 361 | - } |
|
| 26 | + /** |
|
| 27 | + * @var Response |
|
| 28 | + */ |
|
| 29 | + protected $response = null; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Single result |
|
| 33 | + * When the Places service returns results from a details request, it places them within a single result |
|
| 34 | + * |
|
| 35 | + * @var array |
|
| 36 | + * @see https://developers.google.com/places/web-service/details#PlaceDetailsResults |
|
| 37 | + */ |
|
| 38 | + protected $result = null; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * contains an array of places, with information about each. |
|
| 42 | + * The Places API returns up to 20 establishment results per query. |
|
| 43 | + * Additionally, political results may be returned which serve to identify the area of the request. |
|
| 44 | + * |
|
| 45 | + * @var array |
|
| 46 | + * @see https://developers.google.com/places/web-service/search#PlaceSearchResults |
|
| 47 | + */ |
|
| 48 | + protected $results = null; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * contains metadata on the request. |
|
| 52 | + * |
|
| 53 | + * @var string |
|
| 54 | + * @see https://developers.google.com/places/web-service/search#PlaceSearchStatusCodes |
|
| 55 | + */ |
|
| 56 | + protected $status = null; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @var string |
|
| 60 | + */ |
|
| 61 | + protected $error_message = null; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * @var array |
|
| 65 | + */ |
|
| 66 | + protected $array_response = null; |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @var null|array |
|
| 70 | + */ |
|
| 71 | + protected $http_status_code = null; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * may contain a set of attributions about this listing which must be displayed to the user (some listings may not have attribution). |
|
| 75 | + * |
|
| 76 | + * @var null|array |
|
| 77 | + * @since 0.5.0 |
|
| 78 | + */ |
|
| 79 | + protected $html_attributions = null; |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * @var null|string |
|
| 83 | + * @since 0.5.0 |
|
| 84 | + */ |
|
| 85 | + protected $next_page_token = null; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * GoogleMapsResponse constructor. |
|
| 89 | + * |
|
| 90 | + * @param Response $response |
|
| 91 | + */ |
|
| 92 | + public function __construct(Response $response) |
|
| 93 | + { |
|
| 94 | + |
|
| 95 | + $this->setResponse($response); |
|
| 96 | + |
|
| 97 | + $this->parseResponse(); |
|
| 98 | + |
|
| 99 | + $this->checkHttpStatusCode(); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @param Response $response |
|
| 104 | + * |
|
| 105 | + * @return GoogleMapsResponse |
|
| 106 | + */ |
|
| 107 | + public function setResponse(Response $response): GoogleMapsResponse |
|
| 108 | + { |
|
| 109 | + |
|
| 110 | + $this->response = $response; |
|
| 111 | + |
|
| 112 | + return $this; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * @return GoogleMapsResponse |
|
| 117 | + * |
|
| 118 | + * @throws RequestException |
|
| 119 | + * @throws ResponseException |
|
| 120 | + */ |
|
| 121 | + protected function parseResponse(): GoogleMapsResponse |
|
| 122 | + { |
|
| 123 | + |
|
| 124 | + $json_response = $this->response->getBody()->getContents(); |
|
| 125 | + $array_response = $this->toArray($json_response); |
|
| 126 | + $result = null; |
|
| 127 | + $results = null; |
|
| 128 | + |
|
| 129 | + if (empty($array_response[GoogleMapsResponseFields::STATUS])) { |
|
| 130 | + throw new ResponseException('Missing "status" in GoogleMapsApi Response'); |
|
| 131 | + } |
|
| 132 | + $this->setStatus($array_response[GoogleMapsResponseFields::STATUS]); |
|
| 133 | + |
|
| 134 | + if ($this->getStatus() != GoogleMapsResponseStatusValues::OK) { |
|
| 135 | + $error_message = 'Something went wrong'; |
|
| 136 | + if (!empty($array_response[GoogleMapsResponseFields::ERROR_MESSAGE])) { |
|
| 137 | + $error_message = $array_response[GoogleMapsResponseFields::ERROR_MESSAGE]; |
|
| 138 | + $this->setErrorMessage($error_message); |
|
| 139 | + } elseif (!empty($array_response[GoogleMapsResponseFields::STATUS])) { |
|
| 140 | + $error_message .= ': ' . $array_response[GoogleMapsResponseFields::STATUS]; |
|
| 141 | + $this->setErrorMessage($error_message); |
|
| 142 | + } |
|
| 143 | + throw new RequestException($error_message); |
|
| 144 | + |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + if (!empty($array_response[GoogleMapsResponseFields::RESULTS])) { |
|
| 148 | + $results = $array_response[GoogleMapsResponseFields::RESULTS]; |
|
| 149 | + |
|
| 150 | + } elseif (!empty($array_response[GoogleMapsResponseFields::CANDIDATES])) { |
|
| 151 | + $results = $array_response[GoogleMapsResponseFields::CANDIDATES]; |
|
| 152 | + |
|
| 153 | + }elseif (!empty($array_response[GoogleMapsResponseFields::RESULT])) { |
|
| 154 | + $result = $array_response[GoogleMapsResponseFields::RESULT]; |
|
| 155 | + |
|
| 156 | + } else { |
|
| 157 | + $result = $array_response; |
|
| 158 | + } |
|
| 159 | + $this->setResult($result); |
|
| 160 | + $this->setResults($results); |
|
| 161 | + |
|
| 162 | + if (!empty($array_response[GoogleMapsResponseFields::HTML_ATTRIBUTIONS])) { |
|
| 163 | + $this->setHtmlAttributions($array_response[GoogleMapsResponseFields::HTML_ATTRIBUTIONS]); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + if (!empty($array_response[GoogleMapsResponseFields::NEXT_PAGE_TOKEN])) { |
|
| 167 | + $this->setNextPageToken($array_response[GoogleMapsResponseFields::NEXT_PAGE_TOKEN]); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + return $this; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @param string $json_response |
|
| 175 | + * |
|
| 176 | + * @return array |
|
| 177 | + */ |
|
| 178 | + public function toArray(string $json_response): array |
|
| 179 | + { |
|
| 180 | + |
|
| 181 | + $this->array_response = json_decode($json_response, true); |
|
| 182 | + |
|
| 183 | + return $this->array_response; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * @return string |
|
| 188 | + */ |
|
| 189 | + public function getStatus(): string |
|
| 190 | + { |
|
| 191 | + |
|
| 192 | + return $this->status; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * @param string $status |
|
| 197 | + * |
|
| 198 | + * @return GoogleMapsResponse |
|
| 199 | + */ |
|
| 200 | + public function setStatus(string $status) |
|
| 201 | + { |
|
| 202 | + |
|
| 203 | + $this->status = $status; |
|
| 204 | + |
|
| 205 | + return $this; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * Check HTTP status code (silent/No exceptions!) |
|
| 210 | + * @return int |
|
| 211 | + */ |
|
| 212 | + protected function checkHttpStatusCode(): int |
|
| 213 | + { |
|
| 214 | + |
|
| 215 | + $this->http_status_code = $this->response->getStatusCode(); |
|
| 216 | + |
|
| 217 | + return $this->http_status_code; |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + /** |
|
| 221 | + * @return array |
|
| 222 | + */ |
|
| 223 | + public function getResults() |
|
| 224 | + { |
|
| 225 | + |
|
| 226 | + return $this->results; |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * @param array $results |
|
| 231 | + * |
|
| 232 | + * @return $this |
|
| 233 | + */ |
|
| 234 | + public function setResults(?array $results) |
|
| 235 | + { |
|
| 236 | + |
|
| 237 | + $this->results = $results; |
|
| 238 | + |
|
| 239 | + return $this; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * @return array |
|
| 244 | + * @since v0.6.0 |
|
| 245 | + */ |
|
| 246 | + public function getResult() |
|
| 247 | + { |
|
| 248 | + |
|
| 249 | + return $this->result; |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * @param array $result |
|
| 254 | + * |
|
| 255 | + * @return $this |
|
| 256 | + * @since v0.6.0 |
|
| 257 | + */ |
|
| 258 | + public function setResult(?array $result) |
|
| 259 | + { |
|
| 260 | + |
|
| 261 | + $this->result = $result; |
|
| 262 | + |
|
| 263 | + return $this; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * @return array |
|
| 268 | + */ |
|
| 269 | + public function getArrayResponse(): array |
|
| 270 | + { |
|
| 271 | + |
|
| 272 | + return $this->array_response; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * @param array $array_response |
|
| 277 | + * |
|
| 278 | + * @return GoogleMapsResponse |
|
| 279 | + */ |
|
| 280 | + public function setArrayResponse(array $array_response): GoogleMapsResponse |
|
| 281 | + { |
|
| 282 | + |
|
| 283 | + $this->array_response = $array_response; |
|
| 284 | + |
|
| 285 | + return $this; |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * @return mixed |
|
| 290 | + */ |
|
| 291 | + public function getErrorMessage() |
|
| 292 | + { |
|
| 293 | + |
|
| 294 | + return $this->error_message; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + /** |
|
| 298 | + * @param $error_message |
|
| 299 | + * |
|
| 300 | + * @return GoogleMapsResponse |
|
| 301 | + */ |
|
| 302 | + public function setErrorMessage($error_message): GoogleMapsResponse |
|
| 303 | + { |
|
| 304 | + |
|
| 305 | + $this->error_message = $error_message; |
|
| 306 | + |
|
| 307 | + return $this; |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + /** |
|
| 311 | + * @return int |
|
| 312 | + */ |
|
| 313 | + public function getHttpStatusCode(): int |
|
| 314 | + { |
|
| 315 | + |
|
| 316 | + return intval($this->http_status_code); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + /** |
|
| 320 | + * @return array|null |
|
| 321 | + */ |
|
| 322 | + public function getHtmlAttributions(): ?array |
|
| 323 | + { |
|
| 324 | + |
|
| 325 | + return $this->html_attributions; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + /** |
|
| 329 | + * @param array|null $html_attributions |
|
| 330 | + * |
|
| 331 | + * @return GoogleMapsResponse |
|
| 332 | + */ |
|
| 333 | + public function setHtmlAttributions(?array $html_attributions): GoogleMapsResponse |
|
| 334 | + { |
|
| 335 | + |
|
| 336 | + $this->html_attributions = $html_attributions; |
|
| 337 | + |
|
| 338 | + return $this; |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * @return string |
|
| 343 | + */ |
|
| 344 | + public function getNextPageToken(): string |
|
| 345 | + { |
|
| 346 | + |
|
| 347 | + return $this->next_page_token ?? ''; |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * @param $next_page_token |
|
| 352 | + * |
|
| 353 | + * @return GoogleMapsResponse |
|
| 354 | + */ |
|
| 355 | + public function setNextPageToken($next_page_token): GoogleMapsResponse |
|
| 356 | + { |
|
| 357 | + |
|
| 358 | + $this->next_page_token = $next_page_token; |
|
| 359 | + |
|
| 360 | + return $this; |
|
| 361 | + } |
|
| 362 | 362 | |
| 363 | 363 | } |