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.

Code Duplication    Length = 38-43 lines in 3 locations

src/CommandBus/Handler/ProgramHandler.php 1 location

@@ 15-57 (lines=43) @@
12
use React\Promise\PromiseInterface;
13
use function React\Promise\resolve;
14
15
final class ProgramHandler
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(ProgramCommand $command): PromiseInterface
42
    {
43
        return $this->service->call(
44
            'supervisor.getProcessInfo',
45
            [
46
                $command->getName(),
47
            ]
48
        )->then(function (array $program) {
49
            return resolve(
50
                $this->hydrator->hydrate(
51
                    ProgramInterface::HYDRATE_CLASS,
52
                    $program
53
                )
54
            );
55
        });
56
    }
57
}
58

src/CommandBus/Handler/ProgramsHandler.php 1 location

@@ 15-56 (lines=42) @@
12
use function ApiClients\Tools\Rx\observableFromArray;
13
use function React\Promise\resolve;
14
15
final class ProgramsHandler
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
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

src/CommandBus/Handler/StateHandler.php 1 location

@@ 14-51 (lines=38) @@
11
use React\Promise\PromiseInterface;
12
use function React\Promise\resolve;
13
14
final class StateHandler
15
{
16
    /**
17
     * @var XmlRpcService
18
     */
19
    private $service;
20
21
    /**
22
     * @var Hydrator
23
     */
24
    private $hydrator;
25
26
    /**
27
     * @param XmlRpcService $service
28
     * @param Hydrator      $hydrator
29
     */
30
    public function __construct(XmlRpcService $service, Hydrator $hydrator)
31
    {
32
        $this->service = $service;
33
        $this->hydrator = $hydrator;
34
    }
35
36
    /**
37
     * @param  StateCommand     $command
38
     * @return PromiseInterface
39
     */
40
    public function handle(StateCommand $command): PromiseInterface
41
    {
42
        return $this->service->call('supervisor.getState')->then(function (array $state) {
43
            return resolve(
44
                $this->hydrator->hydrate(
45
                    StateInterface::HYDRATE_CLASS,
46
                    $state
47
                )
48
            );
49
        });
50
    }
51
}
52