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   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 38
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A doesNotContainIndex() 0 4 1
A doesNotContainKey() 0 4 1
A doesNotContainValue() 0 20 4
A doesNotContainAnything() 0 4 1
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