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 ( 350fc3...9dd22f )
by Cees-Jan
02:32
created

Collection::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace ApiClients\Foundation\Hydrator\Annotation;
5
6
use ApiClients\Foundation\Hydrator\AnnotationInterface;
7
8
/**
9
 * @Annotation
10
 * @Target({"CLASS"})
11
 */
12 View Code Duplication
class Collection implements AnnotationInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * @var array
16
     */
17
    protected $types = [];
18
19
    /**
20
     * Nested constructor.
21
     * @param array $types
22
     */
23 14
    public function __construct(array $types)
24
    {
25 14
        $this->types = $types;
26 14
    }
27
28
    /**
29
     * @return array
30
     */
31 8
    public function properties(): array
32
    {
33 8
        return array_keys($this->types);
34
    }
35
36
    /**
37
     * @param $key
38
     * @return bool
39
     */
40 9
    public function has($key): bool
41
    {
42 9
        return isset($this->types[$key]);
43
    }
44
45
    /**
46
     * @param $key
47
     * @return string
48
     */
49 8
    public function get($key): string
50
    {
51 8
        if (!$this->has($key)) {
52 1
            throw new \InvalidArgumentException();
53
        }
54
55 7
        return $this->types[$key];
56
    }
57
}
58