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.

AcceptLanguage::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 4.0047

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 14
cts 15
cp 0.9333
rs 9.2
c 0
b 0
f 0
cc 4
eloc 14
nc 4
nop 1
crap 4.0047
1
<?php
2
3
namespace Negotiation;
4
5
use Negotiation\Exception\InvalidLanguage;
6
7
final class AcceptLanguage extends BaseAccept implements AcceptHeader
8
{
9
    private $language;
10
    private $script;
11
    private $region;
12
13 20
    public function __construct($value)
14
    {
15 20
        parent::__construct($value);
16
17 20
        $parts = explode('-', $this->type);
18
19 20
        if (2 === count($parts)) {
20 4
            $this->language = $parts[0];
21 4
            $this->region   = $parts[1];
22 20
        } elseif (1 === count($parts)) {
23 17
            $this->language = $parts[0];
24 17
        } elseif (3 === count($parts)) {
25 1
            $this->language = $parts[0];
26 1
            $this->script   = $parts[1];
27 1
            $this->region   = $parts[2];
28 1
        } else {
29
            // TODO: this part is never reached...
30
            throw new InvalidLanguage();
31
        }
32 20
    }
33
34
    /**
35
     * @return string
36
     */
37 10
    public function getSubPart()
38
    {
39 10
        return $this->region;
40
    }
41
42
    /**
43
     * @return string
44
     */
45 10
    public function getBasePart()
46
    {
47 10
        return $this->language;
48
    }
49
}
50