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.

LineDecoder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 21
rs 10
ccs 3
cts 3
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A decode() 0 11 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\React\ChildProcess\Messenger\Messages;
6
7
use Cake\Utility\Hash;
8
use Doctrine\Instantiator\Exception\ExceptionInterface;
9 5
use ReflectionException;
10
11 5
use function WyriHaximus\throwable_decode;
12 3
13
final class LineDecoder
14
{
15 2
    /**
16 1
     * @param array<mixed> $line
17
     *
18
     * @return array<mixed>
19 2
     *
20
     * @throws ExceptionInterface
21
     * @throws ReflectionException
22
     */
23
    public static function decode(array $line): array
24
    {
25
        if ($line[LineEncoder::META_KEY][LineEncoder::TYPE_KEY] === LineEncoder::TYPE_THROWABLE) {
26
            return ['throwable' => throwable_decode($line[LineEncoder::VALUE_KEY])];
27
        }
28
29
        foreach ($line[LineEncoder::META_KEY][LineEncoder::THROWABLES_KEY] as $throwableKey) {
30
            $line[LineEncoder::VALUE_KEY][$throwableKey] = throwable_decode($line[LineEncoder::VALUE_KEY][$throwableKey]);
31
        }
32
33
        return Hash::expand($line[LineEncoder::VALUE_KEY]);
34
    }
35
}
36