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

Rename   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 45
loc 45
ccs 10
cts 11
cp 0.9091
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A properties() 4 4 1
A has() 4 4 1
A get() 8 8 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 Rename 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 $renameMapping = [];
18
19
    /**
20
     * @param array $renameMapping
21
     */
22 8
    public function __construct(array $renameMapping)
23
    {
24 8
        $this->renameMapping = $renameMapping;
25 8
    }
26
27
    /**
28
     * @return array
29
     */
30 6
    public function properties(): array
31
    {
32 6
        return array_keys($this->renameMapping);
33
    }
34
35
    /**
36
     * @param $key
37
     * @return bool
38
     */
39 6
    public function has($key): bool
40
    {
41 6
        return isset($this->renameMapping[$key]);
42
    }
43
44
    /**
45
     * @param $key
46
     * @return string
47
     */
48 6
    public function get($key): string
49
    {
50 6
        if (!$this->has($key)) {
51
            throw new \InvalidArgumentException();
52
        }
53
54 6
        return $this->renameMapping[$key];
55
    }
56
}
57