Completed
Pull Request — master (#2)
by Pol
01:18
created

ErrorObject   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 24
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A unserialize() 0 8 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\valuewrapper\Object;
6
7
/**
8
 * Class ErrorObject
9
 */
10
class ErrorObject extends AbstractExceptionObject
11
{
12
    /**
13
     * ErrorObject constructor.
14
     *
15
     * @param \Error $value
16
     */
17 4
    public function __construct(\Error $value)
18
    {
19 4
        parent::__construct($value);
20 4
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 1
    public function unserialize($serialized)
26
    {
27 1
        $unserialize = \unserialize($serialized);
28
29 1
        $this->set(
30 1
            (new \Error($unserialize['value']['message'], $unserialize['value']['code']))
0 ignored issues
show
Unused Code introduced by
The call to Error::__construct() has too many arguments starting with $unserialize['value']['message'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
31
        );
32 1
    }
33
}
34