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   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 94.74%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 43
ccs 18
cts 19
cp 0.9474
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 4
A getSubPart() 0 4 1
A getBasePart() 0 4 1
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