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 ( fb8f70...fcb615 )
by Cees-Jan
12:21 queued 02:24
created

JsonEncodeHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Transport\CommandBus\Handler;
4
5
use ApiClients\Foundation\Transport\CommandBus\Command\JsonEncodeCommand;
6
use React\EventLoop\LoopInterface;
7
use React\Promise\PromiseInterface;
8
use function WyriHaximus\React\futureFunctionPromise;
9
10
final class JsonEncodeHandler
11
{
12
    /**
13
     * @var LoopInterface
14
     */
15
    private $loop;
16
17
    /**
18
     * @param LoopInterface $loop
19
     */
20
    public function __construct(LoopInterface $loop)
21
    {
22
        $this->loop = $loop;
23
    }
24
25
    /**
26
     * @param JsonEncodeCommand $command
27
     * @return PromiseInterface
28
     */
29
    public function handle(JsonEncodeCommand $command): PromiseInterface
30
    {
31
        return futureFunctionPromise($this->loop, $command->getJson(), function ($json) {
32
            return json_encode($json);
33
        });
34
    }
35
}
36