|
@@ -119,7 +119,7 @@ discard block |
|
|
block discarded – undo |
119
|
119
|
* an empty UserAgent makes no sense |
120
|
120
|
*/ |
121
|
121
|
if ($userAgent == '') { |
122
|
|
- throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
122
|
+ throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
123
|
123
|
} |
124
|
124
|
|
125
|
125
|
$params = [ |
|
@@ -144,7 +144,7 @@ discard block |
|
|
block discarded – undo |
144
|
144
|
$prevEx = $ex->getPrevious(); |
145
|
145
|
|
146
|
146
|
if ($prevEx->hasResponse() === true && $prevEx->getResponse()->getStatusCode() === 403) { |
147
|
|
- throw new Exception\InvalidCredentialsException('Your API userId "' . $this->apiUserId . '" and key "' . $this->apiKey . '" is not valid for ' . $this->getName(), null, $ex); |
|
147
|
+ throw new Exception\InvalidCredentialsException('Your API userId "'.$this->apiUserId.'" and key "'.$this->apiKey.'" is not valid for '.$this->getName(), null, $ex); |
148
|
148
|
} |
149
|
149
|
|
150
|
150
|
throw $ex; |
|
@@ -154,8 +154,8 @@ discard block |
|
|
block discarded – undo |
154
|
154
|
* no json returned? |
155
|
155
|
*/ |
156
|
156
|
$contentType = $response->getHeader('Content-Type'); |
157
|
|
- if (! isset($contentType[0]) || ($contentType[0] != 'application/json;charset=UTF-8' && $contentType[0] != 'application/json;charset=utf-8')) { |
158
|
|
- throw new Exception\RequestException('Could not get valid "application/json;charset=UTF-8" response from "' . $request->getUri() . '". Response is "' . $contentType[0] . '" | ' . $response->getBody()->getContents()); |
|
157
|
+ if (!isset($contentType[0]) || ($contentType[0] != 'application/json;charset=UTF-8' && $contentType[0] != 'application/json;charset=utf-8')) { |
|
158
|
+ throw new Exception\RequestException('Could not get valid "application/json;charset=UTF-8" response from "'.$request->getUri().'". Response is "'.$contentType[0].'" | '.$response->getBody()->getContents()); |
159
|
159
|
} |
160
|
160
|
|
161
|
161
|
$content = json_decode($response->getBody()->getContents()); |
|
@@ -167,15 +167,15 @@ discard block |
|
|
block discarded – undo |
167
|
167
|
switch ($content->api_error) { |
168
|
168
|
|
169
|
169
|
case 1: |
170
|
|
- throw new Exception\RequestException('"' . $content->api_error_msg . '" response from "' . $request->getUri() . '". Response is "' . print_r($content, true) . '"'); |
|
170
|
+ throw new Exception\RequestException('"'.$content->api_error_msg.'" response from "'.$request->getUri().'". Response is "'.print_r($content, true).'"'); |
171
|
171
|
break; |
172
|
172
|
|
173
|
173
|
case 2: |
174
|
|
- throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API userId "' . $this->apiUserId . '" and key "' . $this->apiKey . '" for ' . $this->getName()); |
|
174
|
+ throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API userId "'.$this->apiUserId.'" and key "'.$this->apiKey.'" for '.$this->getName()); |
175
|
175
|
break; |
176
|
176
|
|
177
|
177
|
default: |
178
|
|
- throw new Exception\RequestException('"' . $content->api_error_msg . '" response from "' . $request->getUri() . '". Response is "' . print_r($content, true) . '"'); |
|
178
|
+ throw new Exception\RequestException('"'.$content->api_error_msg.'" response from "'.$request->getUri().'". Response is "'.print_r($content, true).'"'); |
179
|
179
|
break; |
180
|
180
|
} |
181
|
181
|
} |
|
@@ -183,8 +183,8 @@ discard block |
|
|
block discarded – undo |
183
|
183
|
/* |
184
|
184
|
* Missing data? |
185
|
185
|
*/ |
186
|
|
- if (! $content instanceof stdClass) { |
187
|
|
- throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
186
|
+ if (!$content instanceof stdClass) { |
|
187
|
+ throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
188
|
188
|
} |
189
|
189
|
|
190
|
190
|
return $content; |
|
@@ -297,7 +297,7 @@ discard block |
|
|
block discarded – undo |
297
|
297
|
* No result found? |
298
|
298
|
*/ |
299
|
299
|
if ($this->hasResult($resultRaw) !== true) { |
300
|
|
- throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
300
|
+ throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
301
|
301
|
} |
302
|
302
|
|
303
|
303
|
/* |