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 (#3)
by Cees-Jan
02:25
created

BranchesHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Travis\CommandBus\Handler;
4
5
use ApiClients\Client\Travis\CommandBus\Command\BranchesCommand;
6
use ApiClients\Client\Travis\CommandBus\Command\CachesCommand;
7
use ApiClients\Client\Travis\Resource\BranchInterface;
8
use ApiClients\Tools\Services\Client\FetchAndHydrateService;
9
use ApiClients\Tools\Services\Client\FetchAndIterateService;
10
use React\Promise\PromiseInterface;
11
use function React\Promise\resolve;
12
use function WyriHaximus\React\futureFunctionPromise;
13
14 View Code Duplication
final class BranchesHandler
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...
15
{
16
    /**
17
     * @var FetchAndHydrateService
18
     */
19
    private $service;
20
21
    /**
22
     * @param FetchAndIterateService $service
23
     */
24 1
    public function __construct(FetchAndIterateService $service)
25
    {
26 1
        $this->service = $service;
0 ignored issues
show
Documentation Bug introduced by
It seems like $service of type object<ApiClients\Tools\...FetchAndIterateService> is incompatible with the declared type object<ApiClients\Tools\...FetchAndHydrateService> of property $service.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
27 1
    }
28
29
    /**
30
     * Fetch the given repository and hydrate it
31
     *
32
     * @param BranchesCommand $command
33
     * @return PromiseInterface
34
     */
35 1
    public function handle(BranchesCommand $command): PromiseInterface
36
    {
37 1
        return $this->service->handle(
38 1
            'repos/' . (string)$command->getRepositoryId() . '/branches',
39 1
            'branches',
40 1
            BranchInterface::HYDRATE_CLASS
41
        );
42
    }
43
}
44