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