@@ -92,22 +92,22 @@ discard block |
||
92 | 92 | * an empty UserAgent makes no sense |
93 | 93 | */ |
94 | 94 | if ($userAgent == '') { |
95 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
95 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $headers['User-Agent'] = $userAgent; |
99 | 99 | |
100 | - $parameters = '/' . $this->apiKey; |
|
100 | + $parameters = '/'.$this->apiKey; |
|
101 | 101 | $parameters .= '/match?'; |
102 | 102 | |
103 | 103 | $headerString = []; |
104 | 104 | foreach ($headers as $key => $value) { |
105 | - $headerString[] = $key . '=' . rawurlencode($value); |
|
105 | + $headerString[] = $key.'='.rawurlencode($value); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | $parameters .= implode('&', $headerString); |
109 | 109 | |
110 | - $uri = self::$uri . $parameters; |
|
110 | + $uri = self::$uri.$parameters; |
|
111 | 111 | |
112 | 112 | $request = new Request('GET', $uri); |
113 | 113 | |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | $prevEx = $ex->getPrevious(); |
119 | 119 | |
120 | 120 | if ($prevEx->hasResponse() === true && $prevEx->getResponse()->getStatusCode() === 403) { |
121 | - throw new Exception\InvalidCredentialsException('Your API key "' . $this->apiKey . '" is not valid for ' . $this->getName(), null, $ex); |
|
122 | - } elseif($prevEx->hasResponse() !== true){ |
|
121 | + throw new Exception\InvalidCredentialsException('Your API key "'.$this->apiKey.'" is not valid for '.$this->getName(), null, $ex); |
|
122 | + } elseif ($prevEx->hasResponse() !== true) { |
|
123 | 123 | var_dump($prevEx->getRequest()->getHeaders()); |
124 | 124 | var_dump($prevEx->getRequest()->getBody()); |
125 | 125 | exit(); |
@@ -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; charset=utf-8') { |
|
136 | - throw new Exception\RequestException('Could not get valid "application/json; charset=utf-8" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
135 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json; charset=utf-8') { |
|
136 | + throw new Exception\RequestException('Could not get valid "application/json; charset=utf-8" 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->MatchMethod) && $content->MatchMethod == 'None') { |
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->Values)) { |
|
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->Values)) { |
|
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 | /* |