| @@ 250-288 (lines=39) @@ | ||
| 247 | } |
|
| 248 | } |
|
| 249 | ||
| 250 | public function parse($userAgent, array $headers = []) |
|
| 251 | { |
|
| 252 | $parser = $this->getParser(); |
|
| 253 | ||
| 254 | /* @var $resultRaw \stdClass */ |
|
| 255 | $resultRaw = $parser->getBrowser($userAgent); |
|
| 256 | ||
| 257 | /* |
|
| 258 | * No result found? |
|
| 259 | */ |
|
| 260 | if ($this->hasResult($resultRaw) !== true) { |
|
| 261 | throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 262 | } |
|
| 263 | ||
| 264 | /* |
|
| 265 | * Hydrate the model |
|
| 266 | */ |
|
| 267 | $result = new Model\UserAgent(); |
|
| 268 | $result->setProviderResultRaw($resultRaw); |
|
| 269 | ||
| 270 | /* |
|
| 271 | * Bot detection (does only work with full_php_browscap.ini) |
|
| 272 | */ |
|
| 273 | if ($this->isBot($resultRaw) === true) { |
|
| 274 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 275 | ||
| 276 | return $result; |
|
| 277 | } |
|
| 278 | ||
| 279 | /* |
|
| 280 | * hydrate the result |
|
| 281 | */ |
|
| 282 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 283 | $this->hydrateRenderingEngine($result->getRenderingEngine(), $resultRaw); |
|
| 284 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 285 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 286 | ||
| 287 | return $result; |
|
| 288 | } |
|
| 289 | } |
|
| 290 | ||
| @@ 202-235 (lines=34) @@ | ||
| 199 | } |
|
| 200 | } |
|
| 201 | ||
| 202 | public function parse($userAgent, array $headers = []) |
|
| 203 | { |
|
| 204 | $resultRaw = $this->getResult($userAgent, $headers); |
|
| 205 | ||
| 206 | /* |
|
| 207 | * No result found? |
|
| 208 | */ |
|
| 209 | if ($this->hasResult($resultRaw) !== true) { |
|
| 210 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 211 | } |
|
| 212 | ||
| 213 | /* |
|
| 214 | * Hydrate the model |
|
| 215 | */ |
|
| 216 | $result = new Model\UserAgent(); |
|
| 217 | $result->setProviderResultRaw($resultRaw); |
|
| 218 | ||
| 219 | /* |
|
| 220 | * Bot detection |
|
| 221 | */ |
|
| 222 | if ($this->isBot($resultRaw) === true) { |
|
| 223 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 224 | ||
| 225 | return $result; |
|
| 226 | } |
|
| 227 | ||
| 228 | /* |
|
| 229 | * hydrate the result |
|
| 230 | */ |
|
| 231 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 232 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 233 | ||
| 234 | return $result; |
|
| 235 | } |
|
| 236 | } |
|
| 237 | ||
| @@ 170-207 (lines=38) @@ | ||
| 167 | } |
|
| 168 | } |
|
| 169 | ||
| 170 | public function parse($userAgent, array $headers = []) |
|
| 171 | { |
|
| 172 | $parser = $this->getParser(); |
|
| 173 | ||
| 174 | $resultRaw = $parser->parse($userAgent); |
|
| 175 | ||
| 176 | /* |
|
| 177 | * No result found? |
|
| 178 | */ |
|
| 179 | if ($this->hasResult($resultRaw) !== true) { |
|
| 180 | throw new NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 181 | } |
|
| 182 | ||
| 183 | /* |
|
| 184 | * Hydrate the model |
|
| 185 | */ |
|
| 186 | $result = new Model\UserAgent(); |
|
| 187 | $result->setProviderResultRaw($resultRaw); |
|
| 188 | ||
| 189 | /* |
|
| 190 | * Bot detection |
|
| 191 | */ |
|
| 192 | if ($this->isBot($resultRaw) === true) { |
|
| 193 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 194 | ||
| 195 | return $result; |
|
| 196 | } |
|
| 197 | ||
| 198 | /* |
|
| 199 | * hydrate the result |
|
| 200 | */ |
|
| 201 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 202 | // renderingEngine not available |
|
| 203 | // operatingSystem filled OS is mixed! Examples: iPod, iPhone, Android... |
|
| 204 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 205 | ||
| 206 | return $result; |
|
| 207 | } |
|
| 208 | } |
|
| 209 | ||
| @@ 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 | ||