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.

ChainExtractor::extractKey()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Extractor;
6
7
use Symfony\Component\HttpFoundation\Request;
8
9
final class ChainExtractor implements Extractor
10
{
11
    /**
12
     * @var Extractor[]
13
     */
14
    private $extractors = [];
15
16
    public function __construct(array $extractors = [])
17
    {
18
        foreach ($extractors as $extractor) {
19
            $this->add($extractor);
20
        }
21
    }
22
23
    public function add(Extractor $extractor): void
24
    {
25
        $this->extractors[] = $extractor;
26
    }
27
28
    public function extractKey(Request $request): ?string
29
    {
30
        foreach ($this->extractors as $extractor) {
31
            if (null !== $key = $extractor->extractKey($request)) {
32
                return $key;
33
            }
34
        }
35
36
        return null;
37
    }
38
}
39