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.

InvalidArgumentException   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 45
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidType() 0 9 1
A create() 0 12 3
A invalidValueInArray() 0 9 1
A invalidKeyInArray() 0 9 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 InvalidArgumentException as BaseException;
12
13
/**
14
 * @copyright Copyright (c) 2015 Future500 B.V.
15
 * @author    Jasper N. Brouwer <[email protected]>
16
 */
17
final class InvalidArgumentException extends BaseException
18
{
19 9
    public static function invalidType(string $argument, string $expectedType, $actualValue): self
20
    {
21 9
        return self::create(
22 9
            'Argument $%s must be of type %s, %s given',
23 9
            $argument,
24 9
            $expectedType,
25 9
            $actualValue
26
        );
27
    }
28
29 15
    public static function invalidValueInArray(string $argument, string $expectedType, $actualValue): self
30
    {
31 15
        return self::create(
32 15
            'Each value in argument $%s must be of type %s, %s given',
33 15
            $argument,
34 15
            $expectedType,
35 15
            $actualValue
36
        );
37
    }
38
39 12
    public static function invalidKeyInArray(string $argument, string $expectedType, $actualValue): self
40
    {
41 12
        return self::create(
42 12
            'Each key in argument $%s must be of type %s, %s given',
43 12
            $argument,
44 12
            $expectedType,
45 12
            $actualValue
46
        );
47
    }
48
49 36
    private static function create(string $message, string $argument, string $expectedType, $actualValue): self
50
    {
51 36
        if (is_object($actualValue)) {
52 9
            $actualType = get_class($actualValue);
53 27
        } elseif (is_resource($actualValue)) {
54 9
            $actualType = get_resource_type($actualValue);
55
        } else {
56 18
            $actualType = gettype($actualValue);
57
        }
58
59 36
        return new self(sprintf($message, $argument, $expectedType, $actualType));
60
    }
61
}
62