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 ( ae5fa7...163d7c )
by Cees-Jan
10:38 queued 08:37
created

Collection::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace ApiClients\Foundation\Annotations;
5
6
/**
7
 * @Annotation
8
 * @Target({"CLASS"})
9
 */
10
class Collection
11
{
12
    /**
13
     * @var array
14
     */
15
    protected $types = [];
16
17
    /**
18
     * Nested constructor.
19
     * @param array $types
20
     */
21 11
    public function __construct(array $types)
22
    {
23 11
        $this->types = $types;
24 11
    }
25
26
    /**
27
     * @return array
28
     */
29 7
    public function properties(): array
30
    {
31 7
        return array_keys($this->types);
32
    }
33
34
    /**
35
     * @param $key
36
     * @return bool
37
     */
38 9
    public function has($key): bool
39
    {
40 9
        return isset($this->types[$key]);
41
    }
42
43
    /**
44
     * @param $key
45
     * @return string
46
     */
47 8
    public function get($key): string
48
    {
49 8
        if (!$this->has($key)) {
50 1
            throw new \InvalidArgumentException();
51
        }
52
53 7
        return $this->types[$key];
54
    }
55
}
56