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.

Token::getOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 15
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.7666
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\Authentication;
4
5
use ApiClients\Client\Github\AuthenticationInterface;
6
use ApiClients\Foundation\Options as FoundationOptions;
7
use ApiClients\Foundation\Transport\Options as TransportOptions;
8
use ApiClients\Middleware\TokenAuthorization\Options as TokenAuthorizationHeaderMiddlewareOptions;
9
use ApiClients\Middleware\TokenAuthorization\TokenAuthorizationHeaderMiddleware;
10
11 View Code Duplication
final class Token implements AuthenticationInterface
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...
12
{
13
    /**
14
     * @var string
15
     */
16
    private $token;
17
18 1
    public function __construct(string $token)
19
    {
20 1
        $this->token = $token;
21 1
    }
22
23 1
    public function getOptions(): array
24
    {
25
        return [
26 1
            FoundationOptions::TRANSPORT_OPTIONS => [
27
                TransportOptions::MIDDLEWARE => [
28
                    TokenAuthorizationHeaderMiddleware::class,
29
                ],
30
                TransportOptions::DEFAULT_REQUEST_OPTIONS => [
31
                    TokenAuthorizationHeaderMiddleware::class => [
32 1
                        TokenAuthorizationHeaderMiddlewareOptions::TOKEN => $this->token,
33
                    ],
34
                ],
35
            ],
36
        ];
37
    }
38
}
39