PickupRequestQueryType   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 177
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 177
loc 177
rs 10
c 0
b 0
f 0
wmc 13

13 Methods

Rating   Name   Duplication   Size   Complexity  
A setWebshop() 5 5 1
A getExternalReference() 3 3 1
A getDistributor() 3 3 1
A setDistributor() 5 5 1
A getWebshop() 3 3 1
A setExternalReference() 5 5 1
A __construct() 8 8 1
A setTargetWebshop() 5 5 1
A setHash() 5 5 1
A getTargetWebshop() 3 3 1
A setInternalReference() 5 5 1
A getHash() 3 3 1
A getInternalReference() 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 Phpro\SoapClient\Type\RequestInterface;
16
17 View Code Duplication
class PickupRequestQueryType implements RequestInterface
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 string
21
     */
22
    protected $hash = null;
23
24
    /**
25
     * @var int
26
     */
27
    protected $webshop = null;
28
29
    /**
30
     * @var int
31
     */
32
    protected $targetWebshop = null;
33
34
    /**
35
     * @var string
36
     */
37
    protected $internalReference = null;
38
39
    /**
40
     * @var string
41
     */
42
    protected $distributor = null;
43
44
    /**
45
     * @var string
46
     */
47
    protected $externalReference = null;
48
49
    /**
50
     * Constructor.
51
     *
52
     * @var string
53
     * @var int    $webshop
54
     * @var int    $targetWebshop
55
     * @var string $internalReference
56
     * @var string $distributor
57
     * @var string $externalReference
58
     *
59
     * @param mixed $hash
60
     * @param mixed $webshop
61
     * @param mixed $targetWebshop
62
     * @param mixed $internalReference
63
     * @param mixed $distributor
64
     * @param mixed $externalReference
65
     */
66
    public function __construct($hash, $webshop, $targetWebshop, $internalReference, $distributor, $externalReference)
67
    {
68
        $this->hash = $hash;
0 ignored issues
show
Documentation Bug introduced by
$hash is of type mixed, but the property $hash was declared to be of type string. 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...
69
        $this->webshop = $webshop;
70
        $this->targetWebshop = $targetWebshop;
71
        $this->internalReference = $internalReference;
72
        $this->distributor = $distributor;
73
        $this->externalReference = $externalReference;
74
    }
75
76
    /**
77
     * @return string
78
     */
79
    public function getHash()
80
    {
81
        return $this->hash;
82
    }
83
84
    /**
85
     * @param string $hash
86
     *
87
     * @return $this
88
     */
89
    public function setHash($hash)
90
    {
91
        $this->hash = $hash;
92
93
        return $this;
94
    }
95
96
    /**
97
     * @return int
98
     */
99
    public function getWebshop()
100
    {
101
        return $this->webshop;
102
    }
103
104
    /**
105
     * @param int $webshop
106
     *
107
     * @return $this
108
     */
109
    public function setWebshop($webshop)
110
    {
111
        $this->webshop = $webshop;
112
113
        return $this;
114
    }
115
116
    /**
117
     * @return int
118
     */
119
    public function getTargetWebshop()
120
    {
121
        return $this->targetWebshop;
122
    }
123
124
    /**
125
     * @param int $targetWebshop
126
     *
127
     * @return $this
128
     */
129
    public function setTargetWebshop($targetWebshop)
130
    {
131
        $this->targetWebshop = $targetWebshop;
132
133
        return $this;
134
    }
135
136
    /**
137
     * @return string
138
     */
139
    public function getInternalReference()
140
    {
141
        return $this->internalReference;
142
    }
143
144
    /**
145
     * @param string $internalReference
146
     *
147
     * @return $this
148
     */
149
    public function setInternalReference($internalReference)
150
    {
151
        $this->internalReference = $internalReference;
152
153
        return $this;
154
    }
155
156
    /**
157
     * @return string
158
     */
159
    public function getDistributor()
160
    {
161
        return $this->distributor;
162
    }
163
164
    /**
165
     * @param string $distributor
166
     *
167
     * @return $this
168
     */
169
    public function setDistributor($distributor)
170
    {
171
        $this->distributor = $distributor;
172
173
        return $this;
174
    }
175
176
    /**
177
     * @return string
178
     */
179
    public function getExternalReference()
180
    {
181
        return $this->externalReference;
182
    }
183
184
    /**
185
     * @param string $externalReference
186
     *
187
     * @return $this
188
     */
189
    public function setExternalReference($externalReference)
190
    {
191
        $this->externalReference = $externalReference;
192
193
        return $this;
194
    }
195
}
196