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
Push — master ( 22e7f3...55e1e4 )
by Dmitri
02:43
created

ChainStorage::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Key\Storage;
6
7
use Damax\Bundle\ApiAuthBundle\Key\Key;
8
9
final class ChainStorage implements Reader
10
{
11
    /**
12
     * @var Reader[]
13
     */
14
    private $items = [];
15
16
    public function __construct(array $items = [])
17
    {
18
        foreach ($items as $item) {
19
            $this->addStorage($item);
20
        }
21
    }
22
23
    public function addStorage(Reader $storage): void
24
    {
25
        $this->items[] = $storage;
26
    }
27
28
    public function has(string $key): bool
29
    {
30
        foreach ($this->items as $storage) {
31
            if ($storage->has($key)) {
32
                return true;
33
            }
34
        }
35
36
        return false;
37
    }
38
39
    /**
40
     * @throws KeyNotFoundException
41
     */
42
    public function get(string $key): Key
43
    {
44
        foreach ($this->items as $storage) {
45
            if ($storage->has($key)) {
46
                return $storage->get($key);
47
            }
48
        }
49
50
        throw new KeyNotFoundException();
51
    }
52
}
53