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 (#1)
by Cees-Jan
03:05
created

CachesHandler::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\CachesCommand;
6
use ApiClients\Client\Travis\CommandBus\Command\RepositoryCommand;
7
use ApiClients\Client\Travis\Resource\CacheInterface;
8
use ApiClients\Client\Travis\Resource\RepositoryInterface;
9
use ApiClients\Tools\Services\Client\FetchAndHydrateService;
10
use ApiClients\Tools\Services\Client\FetchAndIterateService;
11
use React\Promise\PromiseInterface;
12
use function React\Promise\resolve;
13
use function WyriHaximus\React\futureFunctionPromise;
14
15 View Code Duplication
final class CachesHandler
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...
16
{
17
    /**
18
     * @var FetchAndHydrateService
19
     */
20
    private $service;
21
22
    /**
23
     * @param FetchAndIterateService $service
24
     */
25 1
    public function __construct(FetchAndIterateService $service)
26
    {
27 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...
28 1
    }
29
30
    /**
31
     * Fetch the given repository and hydrate it
32
     *
33
     * @param CachesCommand $command
34
     * @return PromiseInterface
35
     */
36 1
    public function handle(CachesCommand $command): PromiseInterface
37
    {
38 1
        return $this->service->handle(
39 1
            'repos/' . (string)$command->getRepositoryId() . '/caches',
40 1
            'caches',
41 1
            CacheInterface::HYDRATE_CLASS
42
        );
43
    }
44
}
45