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

ArithmeticErrorObject   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A unserialize() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\valuewrapper\Object;
6
7
/**
8
 * Class ArithmeticErrorObject
9
 */
10 View Code Duplication
class ArithmeticErrorObject extends AbstractErrorObject
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * ArithmeticErrorObject constructor.
14
     *
15
     * @param \ArithmeticError $value
16
     */
17
    public function __construct(\ArithmeticError $value)
18
    {
19
        parent::__construct($value);
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function unserialize($serialized)
26
    {
27
        $unserialize = \unserialize($serialized);
28
29
        $this->set(
30
            (new \ArithmeticError($unserialize['value']['message'], $unserialize['value']['code']))
0 ignored issues
show
Unused Code introduced by
The call to ArithmeticError::__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
    }
33
}
34