GetExistingImageLabelsResponse   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 93
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 93
loc 93
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getLabel() 3 3 1
A getMetaData() 3 3 1
A setMetaData() 5 5 1
A setError() 5 5 1
A getError() 3 3 1
A setLabel() 5 5 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 GetExistingImageLabelsResponse implements PaazlResultInterface
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...
18
{
19
    /**
20
     * @var errorType
21
     */
22
    protected $error = null;
23
24
    /**
25
     * @var labelType
26
     */
27
    protected $label = null;
28
29
    /**
30
     * @var labelMetaDataType
31
     */
32
    protected $metaData = null;
33
34
    /**
35
     * Constructor.
36
     *
37
     * @var errorType
38
     * @var labelType         $label
39
     * @var labelMetaDataType $metaData
40
     *
41
     * @param mixed $error
42
     * @param mixed $label
43
     * @param mixed $metaData
44
     */
45
    public function __construct($error, $label, $metaData)
46
    {
47
        $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...
48
        $this->label = $label;
49
        $this->metaData = $metaData;
50
    }
51
52
    /**
53
     * @return errorType
54
     */
55
    public function getError()
56
    {
57
        return $this->error;
58
    }
59
60
    /**
61
     * @param errorType $error
62
     *
63
     * @return $this
64
     */
65
    public function setError($error)
66
    {
67
        $this->error = $error;
68
69
        return $this;
70
    }
71
72
    /**
73
     * @return labelType
74
     */
75
    public function getLabel()
76
    {
77
        return $this->label;
78
    }
79
80
    /**
81
     * @param labelType $label
82
     *
83
     * @return $this
84
     */
85
    public function setLabel($label)
86
    {
87
        $this->label = $label;
88
89
        return $this;
90
    }
91
92
    /**
93
     * @return labelMetaDataType
94
     */
95
    public function getMetaData()
96
    {
97
        return $this->metaData;
98
    }
99
100
    /**
101
     * @param labelMetaDataType $metaData
102
     *
103
     * @return $this
104
     */
105
    public function setMetaData($metaData)
106
    {
107
        $this->metaData = $metaData;
108
109
        return $this;
110
    }
111
}
112