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 ( a55f05...bfb702 )
by Cees-Jan
01:23 queued 24s
created

JsonDecodeService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 22
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A decode() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Tools\Json;
4
5
use ApiClients\Foundation\Service\ServiceInterface;
6
use React\EventLoop\LoopInterface;
7
use React\Promise\CancellablePromiseInterface;
8
use function ExceptionalJSON\decode;
9
use function WyriHaximus\React\futureFunctionPromise;
10
11
final class JsonDecodeService
12
{
13
    /**
14
     * @var LoopInterface
15
     */
16
    private $loop;
17
18
    /**
19
     * @param LoopInterface $loop
20
     */
21 4
    public function __construct(LoopInterface $loop)
22
    {
23 4
        $this->loop = $loop;
24 4
    }
25
26
    public function decode(string $input): CancellablePromiseInterface
27
    {
28 4
        return futureFunctionPromise($this->loop, $input, function ($json) {
29 4
            return decode($json, true);
30 4
        });
31
    }
32
}
33