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

ErrorObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
nc 1
cc 1
nop 1
crap 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