| @@ 243-281 (lines=39) @@ | ||
| 240 | } |
|
| 241 | } |
|
| 242 | ||
| 243 | public function parse($userAgent, array $headers = []) |
|
| 244 | { |
|
| 245 | $parser = $this->getParser(); |
|
| 246 | ||
| 247 | /* @var $resultRaw \stdClass */ |
|
| 248 | $resultRaw = $parser->getBrowser($userAgent); |
|
| 249 | ||
| 250 | /* |
|
| 251 | * No result found? |
|
| 252 | */ |
|
| 253 | if ($this->hasResult($resultRaw) !== true) { |
|
| 254 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 255 | } |
|
| 256 | ||
| 257 | /* |
|
| 258 | * Hydrate the model |
|
| 259 | */ |
|
| 260 | $result = new Model\UserAgent(); |
|
| 261 | $result->setProviderResultRaw($resultRaw); |
|
| 262 | ||
| 263 | /* |
|
| 264 | * Bot detection (does only work with full_php_browscap.ini) |
|
| 265 | */ |
|
| 266 | if ($this->isBot($resultRaw) === true) { |
|
| 267 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 268 | ||
| 269 | return $result; |
|
| 270 | } |
|
| 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 | ||
| @@ 163-200 (lines=38) @@ | ||
| 160 | } |
|
| 161 | } |
|
| 162 | ||
| 163 | public function parse($userAgent, array $headers = []) |
|
| 164 | { |
|
| 165 | $parser = $this->getParser(); |
|
| 166 | ||
| 167 | $resultRaw = $parser->parse($userAgent); |
|
| 168 | ||
| 169 | /* |
|
| 170 | * No result found? |
|
| 171 | */ |
|
| 172 | if ($this->hasResult($resultRaw) !== true) { |
|
| 173 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 174 | } |
|
| 175 | ||
| 176 | /* |
|
| 177 | * Hydrate the model |
|
| 178 | */ |
|
| 179 | $result = new Model\UserAgent(); |
|
| 180 | $result->setProviderResultRaw($resultRaw); |
|
| 181 | ||
| 182 | /* |
|
| 183 | * Bot detection |
|
| 184 | */ |
|
| 185 | if ($this->isBot($resultRaw) === true) { |
|
| 186 | $this->hydrateBot($result->getBot(), $resultRaw); |
|
| 187 | ||
| 188 | return $result; |
|
| 189 | } |
|
| 190 | ||
| 191 | /* |
|
| 192 | * hydrate the result |
|
| 193 | */ |
|
| 194 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 195 | // renderingEngine not available |
|
| 196 | // operatingSystem filled OS is mixed! Examples: iPod, iPhone, Android... |
|
| 197 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 198 | ||
| 199 | return $result; |
|
| 200 | } |
|
| 201 | } |
|
| 202 | ||