| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 6 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 39 | 3 | public function parse($userAgent, array $headers = []) |
|
| 40 | { |
||
| 41 | 3 | foreach ($this->getProviders() as $provider) { |
|
| 42 | /* @var $provider \UserAgentParser\Provider\AbstractProvider */ |
||
| 43 | |||
| 44 | try { |
||
| 45 | 2 | return $provider->parse($userAgent, $headers); |
|
| 46 | 1 | } catch (Exception\NoResultFoundException $ex) { |
|
| 47 | // just catch this and continue to the next provider |
||
| 48 | } |
||
| 49 | 2 | } |
|
| 50 | |||
| 51 | 2 | throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent); |
|
| 52 | } |
||
| 53 | } |
||
| 54 |