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 ( f0deef...e126b8 )
by Cees-Jan
01:58
created

ProgramsHandler::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 15
loc 15
ccs 0
cts 15
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApiClients\Client\Supervisord\CommandBus\Handler;
6
7
use ApiClients\Client\Supervisord\CommandBus\Command\ProgramsCommand;
8
use ApiClients\Client\Supervisord\Resource\ProgramInterface;
9
use ApiClients\Foundation\Hydrator\Hydrator;
10
use ApiClients\Tools\Services\XmlRpc\XmlRpcService;
11
use React\Promise\PromiseInterface;
12
use function ApiClients\Tools\Rx\observableFromArray;
13
use function React\Promise\resolve;
14
15 View Code Duplication
final class ProgramsHandler
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 XmlRpcService
19
     */
20
    private $service;
21
22
    /**
23
     * @var Hydrator
24
     */
25
    private $hydrator;
26
27
    /**
28
     * @param XmlRpcService $service
29
     * @param Hydrator      $hydrator
30
     */
31
    public function __construct(XmlRpcService $service, Hydrator $hydrator)
32
    {
33
        $this->service = $service;
34
        $this->hydrator = $hydrator;
35
    }
36
37
    /**
38
     * @param  ProgramsCommand  $command
39
     * @return PromiseInterface
40
     */
41
    public function handle(ProgramsCommand $command): PromiseInterface
0 ignored issues
show
Unused Code introduced by
The parameter $command is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        return $this->service->call('supervisor.getAllProcessInfo')->then(function (array $xml) {
44
            return resolve(
45
                observableFromArray(
46
                    $xml
47
                )->map(function ($program) {
48
                    return $this->hydrator->hydrate(
49
                        ProgramInterface::HYDRATE_CLASS,
50
                        $program
51
                    );
52
                })
53
            );
54
        });
55
    }
56
}
57