@@ -33,7 +33,7 @@ |
||
33 | 33 | && isset($params_or_address_1['address_stop_type']) |
34 | 34 | ) { |
35 | 35 | parent::__construct($params_or_address_1); |
36 | - } elseif (is_string($params_or_address_1) && $params_or_address_1 != "" |
|
36 | + } elseif (is_string($params_or_address_1) && $params_or_address_1!="" |
|
37 | 37 | && !is_null($cached_lat) && !is_null($cached_lng) && !is_null($address_stop_type) |
38 | 38 | ) { |
39 | 39 | $this->address_1 = $params_or_address_1; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | public function __construct(?array $params = null) |
37 | 37 | { |
38 | - if ($params !== null) { |
|
38 | + if ($params!==null) { |
|
39 | 39 | $this->fillFromArray($params); |
40 | 40 | } |
41 | 41 | } |
@@ -34,10 +34,10 @@ |
||
34 | 34 | |
35 | 35 | public function __construct(?array $params = null) |
36 | 36 | { |
37 | - if ($params !== null) { |
|
37 | + if ($params!==null) { |
|
38 | 38 | foreach ($this as $key => $value) { |
39 | 39 | if (isset($params[$key])) { |
40 | - if ($key === 'results') { |
|
40 | + if ($key==='results') { |
|
41 | 41 | $this->{$key} = array(); |
42 | 42 | foreach ($params[$key] as $ra_key => $ra_value) { |
43 | 43 | if (is_array($ra_value)) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $method = isset($options['method']) ? $options['method'] : 'GET'; |
56 | 56 | $query = isset($options['query']) |
57 | - ? array_filter($options['query'], function ($x) { |
|
57 | + ? array_filter($options['query'], function($x) { |
|
58 | 58 | return !is_null($x); |
59 | 59 | }) : []; |
60 | 60 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $ch = curl_init(); |
80 | 80 | |
81 | 81 | $url = isset($options['url']) |
82 | - ? $options['url'] . '?' . http_build_query(array_merge( |
|
82 | + ? $options['url'].'?'.http_build_query(array_merge( |
|
83 | 83 | $query, |
84 | 84 | ['api_key' => self::getApiKey()] |
85 | 85 | )) : ''; |
@@ -101,19 +101,19 @@ discard block |
||
101 | 101 | // read response headers if need |
102 | 102 | $response_headers = []; |
103 | 103 | if ($return_headers) { |
104 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$response_headers) { |
|
104 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$response_headers) { |
|
105 | 105 | $len = strlen($header); |
106 | 106 | $header = explode(':', $header, 2); |
107 | - if (count($header) >= 2) { |
|
107 | + if (count($header)>=2) { |
|
108 | 108 | $response_headers[strtolower(trim($header[0]))] = trim($header[1]); |
109 | 109 | } |
110 | 110 | return $len; |
111 | 111 | }); |
112 | 112 | } |
113 | 113 | |
114 | - if (null != $file) { |
|
114 | + if (null!=$file) { |
|
115 | 115 | $cfile = new \CURLFile($file, '', ''); |
116 | - $body['strFilename']=$cfile; |
|
116 | + $body['strFilename'] = $cfile; |
|
117 | 117 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
118 | 118 | curl_setopt($ch, CURLOPT_POST, true); |
119 | 119 | curl_setopt($ch, CURLOPT_POSTFIELDS, $body); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if (isset($body)) { |
134 | 134 | $bodyData = json_encode($body); |
135 | 135 | if (isset($options['HTTPHEADER'])) { |
136 | - if (strpos($options['HTTPHEADER'], 'multipart/form-data') > 0) { |
|
136 | + if (strpos($options['HTTPHEADER'], 'multipart/form-data')>0) { |
|
137 | 137 | $bodyData = $body; |
138 | 138 | } |
139 | 139 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if (isset($body)) { |
148 | 148 | $bodyData = json_encode($body); |
149 | 149 | if (isset($options['HTTPHEADER'])) { |
150 | - if (strpos($options['HTTPHEADER'], 'multipart/form-data') > 0) { |
|
150 | + if (strpos($options['HTTPHEADER'], 'multipart/form-data')>0) { |
|
151 | 151 | $bodyData = $body; |
152 | 152 | } |
153 | 153 | } |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | curl_close($ch); |
170 | 170 | |
171 | 171 | $json = null; |
172 | - if (strpos($result, '<?xml') > -1) { |
|
172 | + if (strpos($result, '<?xml')>-1) { |
|
173 | 173 | $xml = simplexml_load_string($result); |
174 | 174 | $json = self::object2array($xml); |
175 | 175 | } else { |
176 | 176 | $json = json_decode($result, true); |
177 | 177 | } |
178 | - if (200 == $code || 201 == $code || 202 == $code) { |
|
178 | + if (200==$code || 201==$code || 202==$code) { |
|
179 | 179 | if (isset($json['errors'])) { |
180 | 180 | throw new ApiError(implode(', ', $json['errors']), $code, $result); |
181 | 181 | } else { |
182 | 182 | // return response headers if they were asked for |
183 | - if (count($response_headers) !== 0) { |
|
183 | + if (count($response_headers)!==0) { |
|
184 | 184 | $res = [ |
185 | 185 | 'code' => $code, |
186 | 186 | 'data' => $json |
@@ -200,16 +200,16 @@ discard block |
||
200 | 200 | if (isset($json['messages'])) { |
201 | 201 | $msg = ''; |
202 | 202 | foreach ($json['messages'] as $key => $value) { |
203 | - if ($msg !== '') { |
|
203 | + if ($msg!=='') { |
|
204 | 204 | $msg .= PHP_EOL; |
205 | 205 | } |
206 | - $msg .= $key . ': ' . implode(', ', $value); |
|
206 | + $msg .= $key.': '.implode(', ', $value); |
|
207 | 207 | } |
208 | 208 | throw new ApiError($msg, $code, $result); |
209 | 209 | } elseif (isset($json['errors'])) { |
210 | 210 | $msg = ''; |
211 | 211 | foreach ($json['errors'] as $key => $value) { |
212 | - if ($msg !== '') { |
|
212 | + if ($msg!=='') { |
|
213 | 213 | $msg .= PHP_EOL; |
214 | 214 | } |
215 | 215 | $msg .= $value; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | if (is_object($result1)) { |
255 | 255 | if ($deepPrinting) { |
256 | 256 | echo "<br>$key1 ------><br>"; |
257 | - $oarray = (array) $result1; |
|
257 | + $oarray = (array)$result1; |
|
258 | 258 | self::simplePrint($oarray, true); |
259 | 259 | echo '------<br>'; |
260 | 260 | } else { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if (is_object($result)) { |
272 | 272 | if ($deepPrinting) { |
273 | 273 | echo "<br>$key ------><br>"; |
274 | - $oarray = (array) $result; |
|
274 | + $oarray = (array)$result; |
|
275 | 275 | self::simplePrint($oarray, true); |
276 | 276 | echo '------<br>'; |
277 | 277 | } else { |