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.
Passed
Push — master ( 2207c6...e66e76 )
by Dmitri
02:14
created

InMemoryStorage::has()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
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 InMemoryStorage implements Reader
10
{
11
    private $data;
12
    private $ttl;
13
14
    public function __construct(array $data, int $ttl = 3600)
15
    {
16
        $this->data = $data;
17
        $this->ttl = $ttl;
18
    }
19
20
    public function has(string $key): bool
21
    {
22
        return (bool) array_search($key, $this->data);
23
    }
24
25
    public function get(string $key): Key
26
    {
27
        if (false === $identity = array_search($key, $this->data)) {
28
            throw new KeyNotFound();
29
        }
30
31
        return new Key($key, $identity, $this->ttl);
32
    }
33
}
34