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 ( d3aed5...e716ac )
by Cees-Jan
19:23 queued 09:31
created

CommunityHealthHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\CommandBus\Handler\Repository;
4
5
use ApiClients\Client\Github\AcceptHeader;
6
use ApiClients\Client\Github\CommandBus\Command\Repository\CommunityHealthCommand;
7
use ApiClients\Client\Github\Resource\Repository\CommunityHealthInterface;
8
use ApiClients\Foundation\Transport\Options as TransportOptions;
9
use ApiClients\Tools\Services\Client\FetchAndHydrateService;
10
use React\Promise\PromiseInterface;
11
12
final class CommunityHealthHandler
13
{
14
    /**
15
     * @var FetchAndHydrateService
16
     */
17
    private $service;
18
19
    /**
20
     * CommunityHealthHandler constructor.
21
     * @param FetchAndHydrateService $service
22
     */
23
    public function __construct(FetchAndHydrateService $service)
24
    {
25
        $this->service = $service;
26
    }
27
28
    /**
29
     * @param CommunityHealthCommand $command
30
     * @return PromiseInterface
31
     */
32
    public function handle(CommunityHealthCommand $command): PromiseInterface
33
    {
34
        return $this->service->fetch(
35
            'repos/' . $command->getFullName() . '/community/profile',
36
            '',
37
            CommunityHealthInterface::HYDRATE_CLASS,
38
            [
39
                TransportOptions::HEADERS => [
40
                    'Accept' => AcceptHeader::getHeader(AcceptHeader::PRESET_COMMUNITY_HEALTH),
41
                ],
42
            ]
43
        );
44
    }
45
}
46