| @@ 264-298 (lines=35) @@ | ||
| 261 | } |
|
| 262 | } |
|
| 263 | ||
| 264 | public function parse($userAgent, array $headers = []) |
|
| 265 | { |
|
| 266 | $resultRaw = $this->getResult($userAgent, $headers); |
|
| 267 | ||
| 268 | /* |
|
| 269 | * No result found? |
|
| 270 | */ |
|
| 271 | if ($this->hasResult($resultRaw) !== true) { |
|
| 272 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 273 | } |
|
| 274 | ||
| 275 | /* |
|
| 276 | * Hydrate the model |
|
| 277 | */ |
|
| 278 | $result = new Model\UserAgent(); |
|
| 279 | $result->setProviderResultRaw($resultRaw); |
|
| 280 | ||
| 281 | /* |
|
| 282 | * Bot detection |
|
| 283 | */ |
|
| 284 | if ($this->isBot($resultRaw) === true) { |
|
| 285 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 286 | ||
| 287 | return $result; |
|
| 288 | } |
|
| 289 | ||
| 290 | /* |
|
| 291 | * hydrate the result |
|
| 292 | */ |
|
| 293 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 294 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 295 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 296 | ||
| 297 | return $result; |
|
| 298 | } |
|
| 299 | } |
|
| 300 | ||
| @@ 173-210 (lines=38) @@ | ||
| 170 | } |
|
| 171 | } |
|
| 172 | ||
| 173 | public function parse($userAgent, array $headers = []) |
|
| 174 | { |
|
| 175 | $parser = $this->getParser(); |
|
| 176 | ||
| 177 | $resultRaw = $parser->parse($userAgent); |
|
| 178 | ||
| 179 | /* |
|
| 180 | * No result found? |
|
| 181 | */ |
|
| 182 | if ($this->hasResult($resultRaw) !== true) { |
|
| 183 | throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 184 | } |
|
| 185 | ||
| 186 | /* |
|
| 187 | * Hydrate the model |
|
| 188 | */ |
|
| 189 | $result = new Model\UserAgent(); |
|
| 190 | $result->setProviderResultRaw($resultRaw); |
|
| 191 | ||
| 192 | /* |
|
| 193 | * Bot detection |
|
| 194 | */ |
|
| 195 | if ($this->isBot($resultRaw) === true) { |
|
| 196 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 197 | ||
| 198 | return $result; |
|
| 199 | } |
|
| 200 | ||
| 201 | /* |
|
| 202 | * hydrate the result |
|
| 203 | */ |
|
| 204 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 205 | // renderingEngine not available |
|
| 206 | // operatingSystem filled OS is mixed! Examples: iPod, iPhone, Android... |
|
| 207 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 208 | ||
| 209 | return $result; |
|
| 210 | } |
|
| 211 | } |
|
| 212 | ||
| @@ 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 | ||
| @@ 255-281 (lines=27) @@ | ||
| 252 | } |
|
| 253 | } |
|
| 254 | ||
| 255 | public function parse($userAgent, array $headers = []) |
|
| 256 | { |
|
| 257 | $resultRaw = $this->getResult($userAgent, $headers); |
|
| 258 | ||
| 259 | /* |
|
| 260 | * No result found? |
|
| 261 | */ |
|
| 262 | if ($this->hasResult($resultRaw) !== true) { |
|
| 263 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 264 | } |
|
| 265 | ||
| 266 | /* |
|
| 267 | * Hydrate the model |
|
| 268 | */ |
|
| 269 | $result = new Model\UserAgent(); |
|
| 270 | $result->setProviderResultRaw($resultRaw); |
|
| 271 | ||
| 272 | /* |
|
| 273 | * hydrate the result |
|
| 274 | */ |
|
| 275 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 276 | $this->hydrateRenderingEngine($result->getRenderingEngine(), $resultRaw); |
|
| 277 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 278 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 279 | ||
| 280 | return $result; |
|
| 281 | } |
|
| 282 | } |
|
| 283 | ||