@@ -54,7 +54,7 @@ |
||
54 | 54 | foreach ($this->typeCheck as $field_name => $field_type) { |
55 | 55 | if (empty($args[$field_name]) || is_null($args[$field_name])) { |
56 | 56 | if ($this->isFieldRequired($field_name)) { |
57 | - $this->addError('Missing "' . $field_name . '" in ' . static::class); |
|
57 | + $this->addError('Missing "'.$field_name.'" in '.static::class); |
|
58 | 58 | } |
59 | 59 | } else { |
60 | 60 | $this->$field_name = $this->parseFieldValue($field_type, $args[$field_name]); |
@@ -58,7 +58,7 @@ |
||
58 | 58 | $params = []; |
59 | 59 | |
60 | 60 | foreach ($this->params as $param_name => $param_value) { |
61 | - $params[$param_name] = (string)$param_value; |
|
61 | + $params[$param_name] = (string) $param_value; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return http_build_query($params); |
@@ -73,13 +73,13 @@ |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | if (is_array($locations)) { |
76 | - $locations = implode('|', array_map(function ($item) { |
|
76 | + $locations = implode('|', array_map(function($item) { |
|
77 | 77 | |
78 | - return (string)$item; |
|
78 | + return (string) $item; |
|
79 | 79 | }, $locations)); |
80 | 80 | } |
81 | 81 | |
82 | - return (string)$locations; |
|
82 | + return (string) $locations; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -143,9 +143,9 @@ |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $request_endpoint = $this->request->getEndpoint(); |
146 | - array_push($url_chunks, $this->api_url . $service_endpoint); |
|
146 | + array_push($url_chunks, $this->api_url.$service_endpoint); |
|
147 | 147 | |
148 | - if($request_endpoint) { |
|
148 | + if ($request_endpoint) { |
|
149 | 149 | array_push($url_chunks, $request_endpoint); |
150 | 150 | } |
151 | 151 |
@@ -106,7 +106,7 @@ |
||
106 | 106 | public function createRequest(array $params, ?string $endpoint = null): GoogleMapsRequest |
107 | 107 | { |
108 | 108 | |
109 | - $this->request = new GoogleMapsRequest($params, $endpoint);; |
|
109 | + $this->request = new GoogleMapsRequest($params, $endpoint); ; |
|
110 | 110 | |
111 | 111 | return $this->request; |
112 | 112 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | /** |
21 | 21 | * @var string |
22 | 22 | */ |
23 | - const TEXTQUERY = "textquery"; |
|
23 | + const TEXTQUERY = "textquery"; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @var string |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | if (empty($params[GoogleMapsRequestFields::INPUT])) { |
88 | - throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required"); |
|
88 | + throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT." field is required"); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT); |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362 |
166 | 166 | $location = $params[GoogleMapsRequestFields::LOCATION]; |
167 | 167 | if (!$location instanceof Location) { |
168 | - throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class'); |
|
168 | + throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION.' field must be instance of '.Location::class.' class'); |
|
169 | 169 | } |
170 | - $params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION]; |
|
170 | + $params[GoogleMapsRequestFields::LOCATION] = (string) $params[GoogleMapsRequestFields::LOCATION]; |
|
171 | 171 | } else { |
172 | - throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required'); |
|
172 | + throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION.' field is required'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | if (!empty($params[GoogleMapsRequestFields::RANKBY]) && |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | empty($params[GoogleMapsRequestFields::TYPE])) { |
181 | 181 | // If rankby=distance (described under Optional parameters below) is specified, |
182 | 182 | // then one or more of keyword, name, or type is required. |
183 | - throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required'); |
|
183 | + throw new InvalidArgumentException('If '.GoogleMapsRequestFields::RANKBY.' is set as "'.RankByValues::DISTANCE.'" one or more of '.GoogleMapsRequestFields::KEYWORD.', '.GoogleMapsRequestFields::NAME.', '.GoogleMapsRequestFields::TYPE.' fields are required'); |
|
184 | 184 | } |
185 | 185 | if (!empty($params[GoogleMapsRequestFields::RADIUS])) { |
186 | 186 | // Note that radius must not be included if rankby=distance (described under Optional parameters below) is specified. |
187 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE); |
|
187 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must not be included if '.GoogleMapsRequestFields::RANKBY.' = '.RankByValues::DISTANCE); |
|
188 | 188 | } |
189 | 189 | } elseif (empty($params[GoogleMapsRequestFields::RADIUS])) { |
190 | 190 | // radius — Defines the distance (in meters) within which to return place results. |
191 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required'); |
|
191 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' field is required'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Config::MAX_PLACE_RADIUS_VALUE) { |
195 | 195 | // The maximum allowed radius is 50 000 meters. |
196 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Config::MAX_PLACE_RADIUS_VALUE); |
|
196 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must be lower than '.Config::MAX_PLACE_RADIUS_VALUE); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH); |
@@ -133,13 +133,13 @@ |
||
133 | 133 | |
134 | 134 | if ($this->getStatus() != GoogleMapsResponseStatusValues::OK) { |
135 | 135 | $error_message = 'Something went wrong'; |
136 | - if($this->getStatus() === 'INVALID_REQUEST'){ |
|
137 | - print_r($array_response);die();} |
|
136 | + if ($this->getStatus() === 'INVALID_REQUEST') { |
|
137 | + print_r($array_response); die(); } |
|
138 | 138 | if (!empty($array_response[GoogleMapsResponseFields::ERROR_MESSAGE])) { |
139 | 139 | $error_message = $array_response[GoogleMapsResponseFields::ERROR_MESSAGE]; |
140 | 140 | $this->setErrorMessage($error_message); |
141 | 141 | } elseif (!empty($array_response[GoogleMapsResponseFields::STATUS])) { |
142 | - $error_message .= ': ' . $array_response[GoogleMapsResponseFields::STATUS]; |
|
142 | + $error_message .= ': '.$array_response[GoogleMapsResponseFields::STATUS]; |
|
143 | 143 | $this->setErrorMessage($error_message); |
144 | 144 | } |
145 | 145 | throw new RequestException($error_message); |