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 ( fb8f70...fcb615 )
by Cees-Jan
12:21 queued 02:24
created

SimpleRequestCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 56
loc 56
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 1
A getRequest() 4 4 1
A getOptions() 4 4 1
A getRefresh() 4 4 1

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 declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Transport\CommandBus\Command;
4
5
use GuzzleHttp\Psr7\Request;
6
use Psr\Http\Message\RequestInterface;
7
8 View Code Duplication
final class SimpleRequestCommand implements RequestCommandInterface
9
{
10
    /**
11
     * @var RequestInterface
12
     */
13
    private $request;
14
15
    /**
16
     * @var array
17
     */
18
    private $options;
19
20
    /**
21
     * @var bool
22
     */
23
    private $refresh;
24
25
    /**
26
     * @param string $path
27
     * @param bool $refresh
28
     * @param array $options
29
     */
30
    public function __construct(string $path, array $options = [], bool $refresh = false)
31
    {
32
        $this->request = new Request(
33
            'GET',
34
            $path
35
        );
36
        $this->options = $options;
37
        $this->refresh = $refresh;
38
    }
39
40
    /**
41
     * @return RequestInterface
42
     */
43
    public function getRequest(): RequestInterface
44
    {
45
        return $this->request;
46
    }
47
48
    /**
49
     * @return array
50
     */
51
    public function getOptions(): array
52
    {
53
        return $this->options;
54
    }
55
56
    /**
57
     * @return bool
58
     */
59
    public function getRefresh(): bool
60
    {
61
        return $this->refresh;
62
    }
63
}
64