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 (#78)
by
unknown
05:26
created

LanguageNegotiator::acceptFactory()   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
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Negotiation;
4
5
class LanguageNegotiator extends AbstractNegotiator
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10 10
    protected function acceptFactory($accept)
11
    {
12 10
        return new AcceptLanguage($accept);
13
    }
14
15
    /**
16
     * {@inheritdoc}
17
     */
18 10
    protected function match(AcceptHeader $acceptLanguage, AcceptHeader $priority, $index)
19
    {
20 10
        if (!$acceptLanguage instanceof AcceptLanguage || !$priority instanceof AcceptLanguage) {
21
            return null;
22
        }
23
24 10
        $ab = $acceptLanguage->getBasePart();
25 10
        $pb = $priority->getBasePart();
26
27 10
        $as = $acceptLanguage->getSubPart();
28 10
        $ps = $priority->getSubPart();
29
30 10
        $baseEqual = !strcasecmp($ab, $pb);
31 10
        $subEqual  = !strcasecmp($as, $ps);
32
33 10
        if (($ab == '*' || $baseEqual)) {
34 8
            $score = 10 * $baseEqual + $subEqual;
35 8
            $q = ($as === null || $subEqual) ? 1 : 0.1;
36
37 8
            return new Match($acceptLanguage->getQuality() * $q, $score, $index);
38
        }
39
40 10
        return null;
41
    }
42
}
43