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.

OutOfRangeException::doesNotContainValue()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 11
cts 11
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 12
nc 4
nop 1
crap 4
1
<?php
2
3
/**
4
 * @license https://github.com/f500/equatable/blob/master/LICENSE MIT
5
 */
6
7
declare(strict_types=1);
8
9
namespace F500\Equatable\Exceptions;
10
11
use OutOfRangeException as BaseException;
12
13
/**
14
 * @copyright Copyright (c) 2015 Future500 B.V.
15
 * @author    Jasper N. Brouwer <[email protected]>
16
 */
17
final class OutOfRangeException extends BaseException
18
{
19 6
    public static function doesNotContainIndex(int $index): self
20
    {
21 6
        return new self(sprintf('Collection does not contain the index %d', $index));
22
    }
23
24 12
    public static function doesNotContainKey(string $key): self
25
    {
26 12
        return new self(sprintf('Collection does not contain the key "%s"', $key));
27
    }
28
29 78
    public static function doesNotContainValue($value): self
30
    {
31 78
        if (!is_object($value)) {
32 24
            return new self(
33 24
                sprintf('Collection does not contain the value %s(%s)', gettype($value), var_export($value, true))
34
            );
35
        }
36
37 54
        if (method_exists($value, 'toString')) {
38 3
            $representation = var_export($value->toString(), true);
39 51
        } elseif (method_exists($value, '__toString')) {
40 3
            $representation = var_export((string) $value, true);
41
        } else {
42 48
            $representation = spl_object_hash($value);
43
        }
44
45 54
        return new self(
46 54
            sprintf('Collection does not contain the value %s(%s)', get_class($value), $representation)
47
        );
48
    }
49
50 15
    public static function doesNotContainAnything(): self
51
    {
52 15
        return new self('Collection does not contain anything');
53
    }
54
}
55