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::decode()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10
ccs 0
cts 0
cp 0
cc 3
nc 3
nop 1
crap 12
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