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
Pull Request — master (#63)
by Cees-Jan
08:00
created

ChecksHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\CommandBus\Handler\Repository\Commit;
4
5
use ApiClients\Client\Github\CommandBus\Command\Repository\Commit\ChecksCommand;
6
use ApiClients\Client\Github\CommandBus\Command\Repository\Commit\StatusesCommand;
7
use ApiClients\Client\Github\Resource\Repository\Commit\CheckInterface;
8
use ApiClients\Client\Github\Resource\Repository\Commit\StatusInterface;
9
use ApiClients\Client\Github\Service\IteratePagesService;
10
use ApiClients\Foundation\Hydrator\Hydrator;
11
use ApiClients\Tools\Services\Client\FetchAndIterateService;
12
use function ApiClients\Tools\Rx\observableFromArray;
13
use React\Promise\PromiseInterface;
14
use function React\Promise\resolve;
15
16
final class ChecksHandler
17
{
18
    /**
19
     * @var FetchAndIterateService
20
     */
21
    private $fetchAndIterateService;
22
23
    /**
24
     * @var Hydrator
25
     */
26
    private $hydrator;
27
28
    /**
29
     * @param FetchAndIterateService $fetchAndIterateService
30
     * @param Hydrator            $hydrator
31
     */
32
    public function __construct(FetchAndIterateService $fetchAndIterateService, Hydrator $hydrator)
33
    {
34
        $this->fetchAndIterateService = $fetchAndIterateService;
35
        $this->hydrator = $hydrator;
36
    }
37
38
    /**
39
     * @param  ChecksCommand  $command
40
     * @return PromiseInterface
41
     */
42
    public function handle(ChecksCommand $command): PromiseInterface
43
    {
44
        return resolve(
45
            $this->fetchAndIterateService->iterate(
46
                $command->getCommit()->url() . '/check-runs',
47
                'check_runs',
48
                CheckInterface::HYDRATE_CLASS
49
            )
50
        );
51
    }
52
}
53