| @@ 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 | ||
| @@ 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 | ||
| @@ 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 | ||
| @@ 239-265 (lines=27) @@ | ||
| 236 | } |
|
| 237 | } |
|
| 238 | ||
| 239 | public function parse($userAgent, array $headers = []) |
|
| 240 | { |
|
| 241 | $resultRaw = $this->getResult($userAgent, $headers); |
|
| 242 | ||
| 243 | /* |
|
| 244 | * No result found? |
|
| 245 | */ |
|
| 246 | if ($this->hasResult($resultRaw) !== true) { |
|
| 247 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 248 | } |
|
| 249 | ||
| 250 | /* |
|
| 251 | * Hydrate the model |
|
| 252 | */ |
|
| 253 | $result = new Model\UserAgent(); |
|
| 254 | $result->setProviderResultRaw($resultRaw); |
|
| 255 | ||
| 256 | /* |
|
| 257 | * hydrate the result |
|
| 258 | */ |
|
| 259 | $this->hydrateBrowser($result->getBrowser(), $resultRaw); |
|
| 260 | $this->hydrateRenderingEngine($result->getRenderingEngine(), $resultRaw); |
|
| 261 | $this->hydrateOperatingSystem($result->getOperatingSystem(), $resultRaw); |
|
| 262 | $this->hydrateDevice($result->getDevice(), $resultRaw); |
|
| 263 | ||
| 264 | return $result; |
|
| 265 | } |
|
| 266 | } |
|
| 267 | ||