@@ -201,15 +201,15 @@ |
||
201 | 201 | $version = $this->getMajor(); |
202 | 202 | |
203 | 203 | if ($this->getMinor() !== null) { |
204 | - $version .= '.' . $this->getMinor(); |
|
204 | + $version .= '.'.$this->getMinor(); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | if ($this->getPatch() !== null) { |
208 | - $version .= '.' . $this->getPatch(); |
|
208 | + $version .= '.'.$this->getPatch(); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | if ($this->getAlias() !== null) { |
212 | - $version = $this->getAlias() . ' - ' . $version; |
|
212 | + $version = $this->getAlias().' - '.$version; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $this->complete = $version; |
@@ -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,7 +118,7 @@ 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); |
|
121 | + throw new Exception\InvalidCredentialsException('Your API key "'.$this->apiKey.'" is not valid for '.$this->getName(), null, $ex); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | throw $ex; |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * no json returned? |
129 | 129 | */ |
130 | 130 | $contentType = $response->getHeader('Content-Type'); |
131 | - if (! isset($contentType[0]) || $contentType[0] != 'application/json; charset=utf-8') { |
|
132 | - throw new Exception\RequestException('Could not get valid "application/json; charset=utf-8" response from "' . $request->getUri() . '". Response is "' . $response->getBody()->getContents() . '"'); |
|
131 | + if (!isset($contentType[0]) || $contentType[0] != 'application/json; charset=utf-8') { |
|
132 | + throw new Exception\RequestException('Could not get valid "application/json; charset=utf-8" response from "'.$request->getUri().'". Response is "'.$response->getBody()->getContents().'"'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $content = json_decode($response->getBody()->getContents()); |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | * No result |
139 | 139 | */ |
140 | 140 | if (isset($content->MatchMethod) && $content->MatchMethod == 'None') { |
141 | - throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
141 | + throw new Exception\NoResultFoundException('No result found for user agent: '.$userAgent); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /* |
145 | 145 | * Missing data? |
146 | 146 | */ |
147 | - if (! $content instanceof stdClass || ! isset($content->Values)) { |
|
148 | - throw new Exception\RequestException('Could not get valid response from "' . $request->getUri() . '". Data is missing "' . $response->getBody()->getContents() . '"'); |
|
147 | + if (!$content instanceof stdClass || !isset($content->Values)) { |
|
148 | + throw new Exception\RequestException('Could not get valid response from "'.$request->getUri().'". Data is missing "'.$response->getBody()->getContents().'"'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /* |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * No result found? |
188 | 188 | */ |
189 | 189 | if ($parser->deviceDetect($headers) !== true) { |
190 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
190 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $resultRaw = $parser->getReply(); |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | /* |
196 | 196 | * No result found? |
197 | 197 | */ |
198 | - if (! isset($resultRaw['hd_specs']) || $this->hasResult($resultRaw['hd_specs']) !== true) { |
|
199 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
198 | + if (!isset($resultRaw['hd_specs']) || $this->hasResult($resultRaw['hd_specs']) !== true) { |
|
199 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /* |
@@ -254,6 +254,10 @@ |
||
254 | 254 | return true; |
255 | 255 | } |
256 | 256 | |
257 | + /** |
|
258 | + * @param string $group |
|
259 | + * @param string $part |
|
260 | + */ |
|
257 | 261 | protected function getRealResult($value, $group = null, $part = null) |
258 | 262 | { |
259 | 263 | if ($this->isRealResult($value, $group, $part) === true) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | private function getPackages() |
155 | 155 | { |
156 | - if (! file_exists('composer.lock')) { |
|
156 | + if (!file_exists('composer.lock')) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | */ |
184 | 184 | protected function checkIfInstalled() |
185 | 185 | { |
186 | - if (! Package::isInstalled($this->getPackageName())) { |
|
187 | - throw new PackageNotLoadedException('You need to install the package ' . $this->getPackageName() . ' to use this provider'); |
|
186 | + if (!Package::isInstalled($this->getPackageName())) { |
|
187 | + throw new PackageNotLoadedException('You need to install the package '.$this->getPackageName().' to use this provider'); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 |
@@ -229,7 +229,7 @@ |
||
229 | 229 | * No result found? |
230 | 230 | */ |
231 | 231 | if ($this->hasResult($browserRaw, $osRaw, $deviceRaw) !== true) { |
232 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
232 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /* |
@@ -185,7 +185,7 @@ |
||
185 | 185 | * No result found? |
186 | 186 | */ |
187 | 187 | if ($parser->isDetected() !== true) { |
188 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
188 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /* |
@@ -199,7 +199,7 @@ |
||
199 | 199 | * No result found? |
200 | 200 | */ |
201 | 201 | if ($this->hasResult($resultRaw) !== true) { |
202 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
202 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /* |
@@ -240,7 +240,7 @@ |
||
240 | 240 | * No result found? |
241 | 241 | */ |
242 | 242 | if ($this->hasResult($resultRaw) !== true) { |
243 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
243 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /* |
@@ -210,7 +210,7 @@ |
||
210 | 210 | * No result found? |
211 | 211 | */ |
212 | 212 | if ($this->hasResult($browser, $os, $device) !== true) { |
213 | - throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
213 | + throw new NoResultFoundException('No result found for user agent: '.$userAgent); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /* |