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 — develop ( 870d79...a1e45f )
by Baptiste
05:29
created

ElementNotFound::__construct()   B

Complexity

Conditions 10
Paths 10

Size

Total Lines 31
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 23
CRAP Score 10

Importance

Changes 0
Metric Value
cc 10
eloc 23
c 0
b 0
f 0
nc 10
nop 1
dl 0
loc 31
ccs 23
cts 23
cp 1
crap 10
rs 7.6666

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Immutable\Exception;
5
6
class ElementNotFound extends InvalidArgumentException implements Exception
7
{
8
    /**
9
     * @param mixed $value
10
     */
11 6
    public function __construct($value)
12
    {
13 6
        switch (\gettype($value)) {
14 6
            case 'object':
15 2
                $class = \get_class($value);
16 2
                $id = \spl_object_id($value);
17 2
                $message = "object($class)#$id";
18 2
                break;
19
20 5
            case 'int':
21 5
            case 'integer':
22 1
            case 'float':
23 1
            case 'string':
24 1
            case 'double':
25 5
                $message = (string) $value;
26 5
                break;
27
28 1
            case 'NULL':
29 1
                $message = 'null';
30 1
                break;
31
32 1
            case 'boolean':
33 1
                $message = $value ? 'true' : 'false';
34 1
                break;
35
36
            default:
37 1
                $message = \gettype($value);
38 1
                break;
39
        }
40
41 6
        parent::__construct($message);
42 6
    }
43
}
44