GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Chain::getProviders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace UserAgentParser\Provider;
3
4
use UserAgentParser\Exception;
5
6
/**
7
 * A chain provider, to use multiple providers at the same time
8
 *
9
 * @author Martin Keckeis <[email protected]>
10
 * @license MIT
11
 */
12
class Chain extends AbstractProvider
13
{
14
    /**
15
     * Name of the provider
16
     *
17
     * @var string
18
     */
19
    protected $name = 'Chain';
20
21
    /**
22
     *
23
     * @var AbstractProvider[]
24
     */
25
    private $providers = [];
26
27
    /**
28
     *
29
     * @param AbstractProvider[] $providers
30
     */
31 12
    public function __construct(array $providers = [])
32
    {
33 12
        $this->providers = $providers;
34 12
    }
35
36
    /**
37
     *
38
     * @return AbstractProvider[]
39
     */
40 4
    public function getProviders()
41
    {
42 4
        return $this->providers;
43
    }
44
45 3
    public function parse($userAgent, array $headers = [])
46
    {
47 3
        foreach ($this->getProviders() as $provider) {
48
            /* @var $provider \UserAgentParser\Provider\AbstractProvider */
49
50
            try {
51 2
                return $provider->parse($userAgent, $headers);
52 1
            } catch (Exception\NoResultFoundException $ex) {
53
                // just catch this and continue to the next provider
54
            }
55
        }
56
57 2
        throw new Exception\NoResultFoundException('No result found for user agent: ' . $userAgent);
58
    }
59
}
60