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.
Passed
Push — master ( 971fda...722cc4 )
by Markus
01:03 queued 12s
created

ArrayAccessFailed::pathNotFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Mschindler83\ArrayAccess;
5
6
use Opis\JsonSchema\ValidationError;
7
8
class ArrayAccessFailed extends \RuntimeException
9
{
10 3
    public static function notAnArray($value): self
11
    {
12 3
        return new self(\sprintf('Given parameter "%s" is not an array', gettype($value)));
13
    }
14
15 2
    public static function invalidType(array $arrayPath, $value, string $expectedType): self
16
    {
17 2
        return new self(
18 2
            \sprintf(
19 2
                '[Array path: %s] Could not get value for "%s". Invalid type "%s". Expected type: "%s"',
20 2
                \implode('.', $arrayPath),
21 2
                end($arrayPath),
22 2
                is_object($value) ? get_class($value) : gettype($value),
23 2
                $expectedType
24
            )
25
        );
26
    }
27
28 2
    public static function invalidDateTimeType(array $arrayPath, $value, string $dateFormat): self
29
    {
30 2
        return new self(
31 2
            \sprintf(
32 2
                '[Array path: %s] Could not get datetime object at "%s" with format "%s" from value "%s"',
33 2
                \implode('.', $arrayPath),
34 2
                end($arrayPath),
35 2
                $dateFormat,
36 2
                $value
37
            )
38
        );
39
    }
40
41 1
    public static function failedByCallbackRestriction(array $arrayPath): self
42
    {
43 1
        return new self(
44 1
            \sprintf(
45 1
                '[Array path: %s] Could not get value for "%s". Reason: Callback restriction',
46 1
                \implode('.', $arrayPath),
47 1
                end($arrayPath),
48
            )
49
        );
50
    }
51
52 2
    public static function pathNotFound(): self
53
    {
54 2
        return new self('Path not found');
55
    }
56
57
    public static function jsonSchemaValidationFailed(ValidationError ...$errors): self
58
    {
59
        $messages = \array_map(
60
            function(ValidationError $error) {
61
                return \sprintf(
62
                    'Error: [%s], Data pointer: [%s]',
63
                    $error->keyword(),
64
                    \implode(', ', $error->dataPointer()),
65
                );
66
            },
67
            $errors
68
        );
69
70
        return new self(
71
            \sprintf('Json schema validation failed: %s', \implode(', ', $messages))
72
        );
73
    }
74
}
75