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