GenerateAdditionalImageDocumentResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 65
loc 65
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A setDocument() 5 5 1
A getError() 3 3 1
A setError() 5 5 1
A getDocument() 3 3 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
/*
4
 * This file is part of PHP CS Fixer.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *     Dariusz Rumiński <[email protected]>
8
 *
9
 * This source file is subject to the MIT license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Etrias\PaazlConnector\SoapTypes;
14
15
use Etrias\PaazlConnector\Result\PaazlResultInterface;
16
17 View Code Duplication
class GenerateAdditionalImageDocumentResponse implements PaazlResultInterface
1 ignored issue
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...
18
{
19
    /**
20
     * @var errorType
21
     */
22
    protected $error = null;
23
24
    /**
25
     * @var additionalDocumentContainerType
26
     */
27
    protected $document = null;
28
29
    /**
30
     * Constructor.
31
     *
32
     * @var errorType
33
     * @var additionalDocumentContainerType $document
34
     *
35
     * @param mixed $error
36
     * @param mixed $document
37
     */
38
    public function __construct($error, $document)
39
    {
40
        $this->error = $error;
0 ignored issues
show
Documentation Bug introduced by
$error is of type mixed, but the property $error was declared to be of type Etrias\PaazlConnector\SoapTypes\errorType. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
41
        $this->document = $document;
42
    }
43
44
    /**
45
     * @return errorType
46
     */
47
    public function getError()
48
    {
49
        return $this->error;
50
    }
51
52
    /**
53
     * @param errorType $error
54
     *
55
     * @return $this
56
     */
57
    public function setError($error)
58
    {
59
        $this->error = $error;
60
61
        return $this;
62
    }
63
64
    /**
65
     * @return additionalDocumentContainerType
66
     */
67
    public function getDocument()
68
    {
69
        return $this->document;
70
    }
71
72
    /**
73
     * @param additionalDocumentContainerType $document
74
     *
75
     * @return $this
76
     */
77
    public function setDocument($document)
78
    {
79
        $this->document = $document;
80
81
        return $this;
82
    }
83
}
84