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::match()   C

Complexity

Conditions 7
Paths 6

Size

Total Lines 24
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 7.0178
Metric Value
dl 0
loc 24
ccs 13
cts 14
cp 0.9286
rs 6.7272
cc 7
eloc 14
nc 6
nop 3
crap 7.0178
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