| @@ 207-240 (lines=34) @@ | ||
| 204 | } |
|
| 205 | } |
|
| 206 | ||
| 207 | public function parse($userAgent, array $headers = []) |
|
| 208 | { |
|
| 209 | $resultRaw = $this->getResult($userAgent, $headers); |
|
| 210 | ||
| 211 | /* |
|
| 212 | * No result found? |
|
| 213 | */ |
|
| 214 | if ($this->hasResult($resultRaw) !== true) { |
|
| 215 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 216 | } |
|
| 217 | ||
| 218 | /* |
|
| 219 | * Hydrate the model |
|
| 220 | */ |
|
| 221 | $result = new Model\UserAgent(); |
|
| 222 | $result->setProviderResultRaw($resultRaw); |
|
| 223 | ||
| 224 | /* |
|
| 225 | * Bot detection |
|
| 226 | */ |
|
| 227 | if ($this->isBot($resultRaw) === true) { |
|
| 228 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 229 | ||
| 230 | return $result; |
|
| 231 | } |
|
| 232 | ||
| 233 | /* |
|
| 234 | * hydrate the result |
|
| 235 | */ |
|
| 236 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 237 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 238 | ||
| 239 | return $result; |
|
| 240 | } |
|
| 241 | } |
|
| 242 | ||
| @@ 274-300 (lines=27) @@ | ||
| 271 | } |
|
| 272 | } |
|
| 273 | ||
| 274 | public function parse($userAgent, array $headers = []) |
|
| 275 | { |
|
| 276 | $resultRaw = $this->getResult($userAgent, $headers); |
|
| 277 | ||
| 278 | /* |
|
| 279 | * No result found? |
|
| 280 | */ |
|
| 281 | if ($this->hasResult($resultRaw) !== true) { |
|
| 282 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 283 | } |
|
| 284 | ||
| 285 | /* |
|
| 286 | * Hydrate the model |
|
| 287 | */ |
|
| 288 | $result = new Model\UserAgent(); |
|
| 289 | $result->setProviderResultRaw($resultRaw); |
|
| 290 | ||
| 291 | /* |
|
| 292 | * hydrate the result |
|
| 293 | */ |
|
| 294 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 295 | $this->hydrateRenderingEngine($result->getRenderingEngine(), $resultRaw); |
|
| 296 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 297 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 298 | ||
| 299 | return $result; |
|
| 300 | } |
|
| 301 | } |
|
| 302 | ||
| @@ 181-218 (lines=38) @@ | ||
| 178 | } |
|
| 179 | } |
|
| 180 | ||
| 181 | public function parse($userAgent, array $headers = []) |
|
| 182 | { |
|
| 183 | $parser = $this->getParser(); |
|
| 184 | ||
| 185 | $resultRaw = $parser->parse($userAgent); |
|
| 186 | ||
| 187 | /* |
|
| 188 | * No result found? |
|
| 189 | */ |
|
| 190 | if ($this->hasResult($resultRaw) !== true) { |
|
| 191 | throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 192 | } |
|
| 193 | ||
| 194 | /* |
|
| 195 | * Hydrate the model |
|
| 196 | */ |
|
| 197 | $result = new Model\UserAgent(); |
|
| 198 | $result->setProviderResultRaw($resultRaw); |
|
| 199 | ||
| 200 | /* |
|
| 201 | * Bot detection |
|
| 202 | */ |
|
| 203 | if ($this->isBot($resultRaw) === true) { |
|
| 204 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 205 | ||
| 206 | return $result; |
|
| 207 | } |
|
| 208 | ||
| 209 | /* |
|
| 210 | * hydrate the result |
|
| 211 | */ |
|
| 212 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 213 | // renderingEngine not available |
|
| 214 | // operatingSystem filled OS is mixed! Examples: iPod, iPhone, Android... |
|
| 215 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 216 | ||
| 217 | return $result; |
|
| 218 | } |
|
| 219 | } |
|
| 220 | ||
| @@ 285-319 (lines=35) @@ | ||
| 282 | } |
|
| 283 | } |
|
| 284 | ||
| 285 | public function parse($userAgent, array $headers = []) |
|
| 286 | { |
|
| 287 | $resultRaw = $this->getResult($userAgent, $headers); |
|
| 288 | ||
| 289 | /* |
|
| 290 | * No result found? |
|
| 291 | */ |
|
| 292 | if ($this->hasResult($resultRaw) !== true) { |
|
| 293 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 294 | } |
|
| 295 | ||
| 296 | /* |
|
| 297 | * Hydrate the model |
|
| 298 | */ |
|
| 299 | $result = new Model\UserAgent(); |
|
| 300 | $result->setProviderResultRaw($resultRaw); |
|
| 301 | ||
| 302 | /* |
|
| 303 | * Bot detection |
|
| 304 | */ |
|
| 305 | if ($this->isBot($resultRaw) === true) { |
|
| 306 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 307 | ||
| 308 | return $result; |
|
| 309 | } |
|
| 310 | ||
| 311 | /* |
|
| 312 | * hydrate the result |
|
| 313 | */ |
|
| 314 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 315 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 316 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 317 | ||
| 318 | return $result; |
|
| 319 | } |
|
| 320 | } |
|
| 321 | ||