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.

Payload::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\React\ChildProcess\Messenger\Messages;
6
7
use ArrayAccess;
8
use JsonSerializable;
9
// phpcs:ignore SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
10
use ReturnTypeWillChange;
11
12 19
/**
13
 * @phpstan-ignore-next-line
14 19
 */
15 19
final class Payload implements JsonSerializable, ArrayAccess
16
{
17
    /** @var array<mixed> */
18
    protected array $payload = [];
19
20 3
    /**
21
     * @param array<mixed> $payload
22 3
     *
23
     * @phpstan-ignore-next-line
24
     */
25
    public function __construct(array $payload = []) /** @phpstan-ignore-line  */
26
    {
27
        $this->payload = $payload;
28 12
    }
29
30 12
    /**
31
     * @return array<mixed>
32
     */
33 1
    public function getPayload(): array
34
    {
35 1
        return $this->payload;
36 1
    }
37
38 1
    /**
39
     * @return array<mixed>
40 1
     */
41
    public function jsonSerialize(): array
42 1
    {
43
        return $this->payload;
44 1
    }
45
46
    /**
47 1
     * @param mixed|null $offset
48
     * @param mixed      $value
49 1
     */
50 1
    public function offsetSet($offset, $value): void
51
    {
52 1
        if ($offset === null) {
53
            $this->payload[] = $value;
54 1
        } else {
55
            $this->payload[$offset] = $value;
56
        }
57
    }
58
59
    /**
60
     * @param mixed $offset
61
     */
62
    public function offsetExists($offset): bool
63
    {
64
        /** @phpstan-ignore-next-line */
65
        return isset($this->payload[$offset]);
66
    }
67
68
    /**
69
     * @param mixed $offset
70
     */
71
    public function offsetUnset($offset): void
72
    {
73
        unset($this->payload[$offset]);
74
    }
75
76
    /**
77
     * @param mixed $offset
78
     *
79
     * @return mixed|null
80
     */
81
    #[ReturnTypeWillChange]
82
    public function offsetGet($offset)
83
    {
84
        return $this->payload[$offset] ?? null;
85
    }
86
}
87