@@ -52,11 +52,11 @@ |
||
| 52 | 52 | /* @var $response \GuzzleHttp\Psr7\Response */ |
| 53 | 53 | $response = $this->getClient()->send($request); |
| 54 | 54 | } catch (GuzzleHttpException $ex) { |
| 55 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '"', null, $ex); |
|
| 55 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'"', null, $ex); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if ($response->getStatusCode() !== 200) { |
| 59 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Status code is: "' . $response->getStatusCode() . '"'); |
|
| 59 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Status code is: "'.$response->getStatusCode().'"'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | return $response; |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | * an empty UserAgent makes no sense |
| 92 | 92 | */ |
| 93 | 93 | if ($userAgent == '') { |
| 94 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 94 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $parameters = '/' . $this->apiKey; |
|
| 98 | - $parameters .= '/' . rawurlencode($userAgent); |
|
| 97 | + $parameters = '/'.$this->apiKey; |
|
| 98 | + $parameters .= '/'.rawurlencode($userAgent); |
|
| 99 | 99 | |
| 100 | - $uri = self::$uri . $parameters; |
|
| 100 | + $uri = self::$uri.$parameters; |
|
| 101 | 101 | |
| 102 | 102 | $request = new Request('GET', $uri); |
| 103 | 103 | |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | * Error |
| 118 | 118 | */ |
| 119 | 119 | if (isset($content->error->code) && $content->error->code == 'key_invalid') { |
| 120 | - throw new Exception\InvalidCredentialsException('Your API key "' . $this->apiKey . '" is not valid for ' . $this->getName(), null, $ex); |
|
| 120 | + throw new Exception\InvalidCredentialsException('Your API key "'.$this->apiKey.'" is not valid for '.$this->getName(), null, $ex); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if (isset($content->error->code) && $content->error->code == 'useragent_invalid') { |
| 124 | - throw new Exception\RequestException('User agent is invalid "' . $userAgent . '"'); |
|
| 124 | + throw new Exception\RequestException('User agent is invalid "'.$userAgent.'"'); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | * no json returned? |
| 133 | 133 | */ |
| 134 | 134 | $contentType = $response->getHeader('Content-Type'); |
| 135 | - if (! isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 136 | - throw new Exception\RequestException('Could not get valid "application/json" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 135 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 136 | + throw new Exception\RequestException('Could not get valid "application/json" response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $content = json_decode($response->getBody()->getContents()); |
@@ -142,14 +142,14 @@ discard block |
||
| 142 | 142 | * No result |
| 143 | 143 | */ |
| 144 | 144 | if (isset($content->error->code) && $content->error->code == 'useragent_not_found') { |
| 145 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 145 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /* |
| 149 | 149 | * Missing data? |
| 150 | 150 | */ |
| 151 | - if (! $content instanceof stdClass || ! isset($content->data)) { |
|
| 152 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Data is missing "' . $response->getBody()->getContents() . '"'); |
|
| 151 | + if (!$content instanceof stdClass || !isset($content->data)) { |
|
| 152 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Data is missing "'.$response->getBody()->getContents().'"'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return $content->data; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * an empty UserAgent makes no sense |
| 124 | 124 | */ |
| 125 | 125 | if ($userAgent == '') { |
| 126 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 126 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $params = [ |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | * no json returned? |
| 142 | 142 | */ |
| 143 | 143 | $contentType = $response->getHeader('Content-Type'); |
| 144 | - if (! isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 145 | - throw new Exception\RequestException('Could not get valid "application/json" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 144 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 145 | + throw new Exception\RequestException('Could not get valid "application/json" response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | $content = json_decode($response->getBody()->getContents()); |
@@ -151,36 +151,36 @@ discard block |
||
| 151 | 151 | * No result |
| 152 | 152 | */ |
| 153 | 153 | if (isset($content->message_code) && $content->message_code == 'no_user_agent') { |
| 154 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 154 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /* |
| 158 | 158 | * Limit exceeded |
| 159 | 159 | */ |
| 160 | 160 | if (isset($content->message_code) && $content->message_code == 'usage_limit_exceeded') { |
| 161 | - throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API key "' . $this->apiKey . '" for ' . $this->getName()); |
|
| 161 | + throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API key "'.$this->apiKey.'" for '.$this->getName()); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /* |
| 165 | 165 | * Error |
| 166 | 166 | */ |
| 167 | 167 | if (isset($content->message_code) && $content->message_code == 'no_api_user_key') { |
| 168 | - throw new Exception\InvalidCredentialsException('Missing API key for ' . $this->getName()); |
|
| 168 | + throw new Exception\InvalidCredentialsException('Missing API key for '.$this->getName()); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if (isset($content->message_code) && $content->message_code == 'user_key_invalid') { |
| 172 | - throw new Exception\InvalidCredentialsException('Your API key "' . $this->apiKey . '" is not valid for ' . $this->getName()); |
|
| 172 | + throw new Exception\InvalidCredentialsException('Your API key "'.$this->apiKey.'" is not valid for '.$this->getName()); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if (! isset($content->result) || $content->result !== 'success') { |
|
| 176 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 175 | + if (!isset($content->result) || $content->result !== 'success') { |
|
| 176 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /* |
| 180 | 180 | * Missing data? |
| 181 | 181 | */ |
| 182 | - if (! $content instanceof stdClass || ! isset($content->parse) || ! $content->parse instanceof stdClass) { |
|
| 183 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . print_r($content, true) . '"'); |
|
| 182 | + if (!$content instanceof stdClass || !isset($content->parse) || !$content->parse instanceof stdClass) { |
|
| 183 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Response is "'.print_r($content, true).'"'); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return $content->parse; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * No result found? |
| 290 | 290 | */ |
| 291 | 291 | if ($this->hasResult($resultRaw) !== true) { |
| 292 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 292 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /* |
@@ -119,7 +119,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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') { |
|
| 158 | - throw new Exception\RequestException('Could not get valid "application/json" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 157 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json;charset=UTF-8') { |
|
| 158 | + throw new Exception\RequestException('Could not get valid "application/json" response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $content = json_decode($response->getBody()->getContents()); |
@@ -167,15 +167,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | /* |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | * an empty UserAgent makes no sense |
| 80 | 80 | */ |
| 81 | 81 | if ($userAgent == '') { |
| 82 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 82 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $parameters = '?licencekey=' . rawurlencode($this->apiKey); |
|
| 86 | - $parameters .= '&useragent=' . rawurlencode($userAgent); |
|
| 85 | + $parameters = '?licencekey='.rawurlencode($this->apiKey); |
|
| 86 | + $parameters .= '&useragent='.rawurlencode($userAgent); |
|
| 87 | 87 | |
| 88 | - $uri = self::$uri . $parameters; |
|
| 88 | + $uri = self::$uri.$parameters; |
|
| 89 | 89 | |
| 90 | 90 | // key to lower |
| 91 | 91 | $headers = array_change_key_case($headers); |
| 92 | 92 | |
| 93 | 93 | $newHeaders = []; |
| 94 | 94 | foreach ($headers as $key => $value) { |
| 95 | - $newHeaders['X-DA-' . $key] = $value; |
|
| 95 | + $newHeaders['X-DA-'.$key] = $value; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $newHeaders['User-Agent'] = 'ThaDafinser/UserAgentParser:v1.4'; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $prevEx = $ex->getPrevious(); |
| 107 | 107 | |
| 108 | 108 | if ($prevEx->hasResponse() === true && $prevEx->getResponse()->getStatusCode() === 403) { |
| 109 | - throw new Exception\InvalidCredentialsException('Your API key "' . $this->apiKey . '" is not valid for ' . $this->getName(), null, $ex); |
|
| 109 | + throw new Exception\InvalidCredentialsException('Your API key "'.$this->apiKey.'" is not valid for '.$this->getName(), null, $ex); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | throw $ex; |
@@ -116,21 +116,21 @@ discard block |
||
| 116 | 116 | * no json returned? |
| 117 | 117 | */ |
| 118 | 118 | $contentType = $response->getHeader('Content-Type'); |
| 119 | - if (! isset($contentType[0]) || $contentType[0] != 'application/json; charset=UTF-8') { |
|
| 120 | - throw new Exception\RequestException('Could not get valid "application/json" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 119 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json; charset=UTF-8') { |
|
| 120 | + throw new Exception\RequestException('Could not get valid "application/json" response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $content = json_decode($response->getBody()->getContents()); |
| 124 | 124 | |
| 125 | - if (! $content instanceof stdClass || ! isset($content->properties)) { |
|
| 126 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 125 | + if (!$content instanceof stdClass || !isset($content->properties)) { |
|
| 126 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /* |
| 130 | 130 | * No result found? |
| 131 | 131 | */ |
| 132 | - if (! $content->properties instanceof stdClass || count((array) $content->properties) === 0) { |
|
| 133 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 132 | + if (!$content->properties instanceof stdClass || count((array) $content->properties) === 0) { |
|
| 133 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | return $content->properties; |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | * an empty UserAgent makes no sense |
| 97 | 97 | */ |
| 98 | 98 | if ($userAgent == '') { |
| 99 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 99 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $parameters = 'uas=' . rawurlencode($userAgent); |
|
| 102 | + $parameters = 'uas='.rawurlencode($userAgent); |
|
| 103 | 103 | $parameters .= '&getJSON=all'; |
| 104 | 104 | |
| 105 | - $uri = self::$uri . '?' . $parameters; |
|
| 105 | + $uri = self::$uri.'?'.$parameters; |
|
| 106 | 106 | |
| 107 | 107 | $request = new Request('GET', $uri); |
| 108 | 108 | |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | * no json returned? |
| 113 | 113 | */ |
| 114 | 114 | $contentType = $response->getHeader('Content-Type'); |
| 115 | - if (! isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 116 | - throw new Exception\RequestException('Could not get valid "application/json" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 115 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 116 | + throw new Exception\RequestException('Could not get valid "application/json" response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $content = json_decode($response->getBody()->getContents()); |
| 120 | 120 | |
| 121 | - if (! $content instanceof stdClass) { |
|
| 122 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 121 | + if (!$content instanceof stdClass) { |
|
| 122 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $content; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * No result found? |
| 217 | 217 | */ |
| 218 | 218 | if ($this->hasResult($resultRaw) !== true) { |
| 219 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 219 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /* |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * an empty UserAgent makes no sense |
| 98 | 98 | */ |
| 99 | 99 | if ($userAgent == '') { |
| 100 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 100 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $params = [ |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * no json returned? |
| 118 | 118 | */ |
| 119 | 119 | $contentType = $response->getHeader('Content-Type'); |
| 120 | - if (! isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 121 | - throw new Exception\RequestException('Could not get valid "application/json" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 120 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json') { |
|
| 121 | + throw new Exception\RequestException('Could not get valid "application/json" response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $content = json_decode($response->getBody()->getContents()); |
@@ -127,29 +127,29 @@ discard block |
||
| 127 | 127 | * No result found? |
| 128 | 128 | */ |
| 129 | 129 | if (isset($content->flag) && $content->flag == 3) { |
| 130 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 130 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /* |
| 134 | 134 | * Errors |
| 135 | 135 | */ |
| 136 | 136 | if (isset($content->flag) && $content->flag == 4) { |
| 137 | - throw new Exception\InvalidCredentialsException('Your API key "' . $this->apiKey . '" is not valid for ' . $this->getName()); |
|
| 137 | + throw new Exception\InvalidCredentialsException('Your API key "'.$this->apiKey.'" is not valid for '.$this->getName()); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (isset($content->flag) && $content->flag == 6) { |
| 141 | - throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API key "' . $this->apiKey . '" for ' . $this->getName()); |
|
| 141 | + throw new Exception\LimitationExceededException('Exceeded the maximum number of request with API key "'.$this->apiKey.'" for '.$this->getName()); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if (isset($content->flag) && $content->flag > 3) { |
| 145 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 145 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /* |
| 149 | 149 | * Missing data? |
| 150 | 150 | */ |
| 151 | - if (! $content instanceof stdClass || ! isset($content->info)) { |
|
| 152 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
| 151 | + if (!$content instanceof stdClass || !isset($content->info)) { |
|
| 152 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return $content; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if ($expectedType !== $parser->getCache()->getType()) { |
| 76 | - throw new InvalidArgumentException('Expected the "' . $expectedType . '" data file. Instead got the "' . $parser->getCache()->getType() . '" data file'); |
|
| 76 | + throw new InvalidArgumentException('Expected the "'.$expectedType.'" data file. Instead got the "'.$parser->getCache()->getType().'" data file'); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * No result found? |
| 240 | 240 | */ |
| 241 | 241 | if ($this->hasResult($resultRaw) !== true) { |
| 242 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 242 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /* |
@@ -54,6 +54,6 @@ |
||
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 57 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
| 58 | 58 | } |
| 59 | 59 | } |