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.
Completed
Push — master ( db3255...800171 )
by Jasper
14:47
created

OutOfRangeException   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A indexOutOfRange() 0 4 1
A keyOutOfRange() 0 4 1
A valueOutOfRange() 0 20 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
    public static function indexOutOfRange(int $index): self
20
    {
21
        return new self(sprintf('Collection does not contain the index %d', $index));
22
    }
23
24
    public static function keyOutOfRange(string $key): self
25
    {
26
        return new self(sprintf('Collection does not contain the key "%s"', $key));
27
    }
28
29
    public static function valueOutOfRange($value): self
30
    {
31
        if (!is_object($value)) {
32
            return new self(
33
                sprintf('Collection does not contain the value %s(%s)', gettype($value), print_r($value, true))
34
            );
35
        }
36
37
        if (method_exists($value, 'toString')) {
38
            $representation = $value->toString();
39
        } elseif (method_exists($value, '__toString')) {
40
            $representation = (string) $value;
41
        } else {
42
            $representation = spl_object_hash($value);
43
        }
44
45
        return new self(
46
            sprintf('Collection does not contain the value %s(%s)', get_class($value), $representation)
47
        );
48
    }
49
}
50