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.
Completed
Pull Request — master (#44)
by Martin
05:39
created

Chain::getComposerPackageName()   A

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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
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
class Chain extends AbstractProvider
7
{
8
    /**
9
     * Name of the provider
10
     *
11
     * @var string
12
     */
13
    protected $name = 'Chain';
14
15
    /**
16
     *
17
     * @var AbstractProvider[]
18
     */
19
    private $providers = [];
20
21
    /**
22
     *
23
     * @param AbstractProvider[] $providers
24
     */
25 7
    public function __construct(array $providers = [])
26
    {
27 7
        $this->providers = $providers;
28 7
    }
29
30
    /**
31
     *
32
     * @return AbstractProvider[]
33
     */
34 4
    public function getProviders()
35
    {
36 4
        return $this->providers;
37
    }
38
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