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 ( d99cb6...ae5fa7 )
by Cees-Jan
7s
created

Rename::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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