RateRequest   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 205
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 205
loc 205
rs 10
c 0
b 0
f 0
wmc 15

15 Methods

Rating   Name   Duplication   Size   Complexity  
A getCountry() 3 3 1
A getPostalCode() 3 3 1
A setShippingOption() 5 5 1
A setTargetWebshop() 5 5 1
A setPostalCode() 5 5 1
A getShippingOption() 3 3 1
A setWebshop() 5 5 1
A getHash() 3 3 1
A getOrderReference() 3 3 1
A setCountry() 5 5 1
A __construct() 9 9 1
A setOrderReference() 5 5 1
A getTargetWebshop() 3 3 1
A getWebshop() 3 3 1
A setHash() 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 Phpro\SoapClient\Type\RequestInterface;
16
17 View Code Duplication
class RateRequest 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 $orderReference = null;
38
39
    /**
40
     * @var string
41
     */
42
    protected $country = null;
43
44
    /**
45
     * @var string
46
     */
47
    protected $postalCode = null;
48
49
    /**
50
     * @var string
51
     */
52
    protected $shippingOption = null;
53
54
    /**
55
     * Constructor.
56
     *
57
     * @var string
58
     * @var int    $webshop
59
     * @var int    $targetWebshop
60
     * @var string $orderReference
61
     * @var string $country
62
     * @var string $postalCode
63
     * @var string $shippingOption
64
     *
65
     * @param mixed $hash
66
     * @param mixed $webshop
67
     * @param mixed $targetWebshop
68
     * @param mixed $orderReference
69
     * @param mixed $country
70
     * @param mixed $postalCode
71
     * @param mixed $shippingOption
72
     */
73
    public function __construct($hash, $webshop, $targetWebshop, $orderReference, $country, $postalCode, $shippingOption)
74
    {
75
        $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...
76
        $this->webshop = $webshop;
77
        $this->targetWebshop = $targetWebshop;
78
        $this->orderReference = $orderReference;
79
        $this->country = $country;
80
        $this->postalCode = $postalCode;
81
        $this->shippingOption = $shippingOption;
82
    }
83
84
    /**
85
     * @return string
86
     */
87
    public function getHash()
88
    {
89
        return $this->hash;
90
    }
91
92
    /**
93
     * @param string $hash
94
     *
95
     * @return $this
96
     */
97
    public function setHash($hash)
98
    {
99
        $this->hash = $hash;
100
101
        return $this;
102
    }
103
104
    /**
105
     * @return int
106
     */
107
    public function getWebshop()
108
    {
109
        return $this->webshop;
110
    }
111
112
    /**
113
     * @param int $webshop
114
     *
115
     * @return $this
116
     */
117
    public function setWebshop($webshop)
118
    {
119
        $this->webshop = $webshop;
120
121
        return $this;
122
    }
123
124
    /**
125
     * @return int
126
     */
127
    public function getTargetWebshop()
128
    {
129
        return $this->targetWebshop;
130
    }
131
132
    /**
133
     * @param int $targetWebshop
134
     *
135
     * @return $this
136
     */
137
    public function setTargetWebshop($targetWebshop)
138
    {
139
        $this->targetWebshop = $targetWebshop;
140
141
        return $this;
142
    }
143
144
    /**
145
     * @return string
146
     */
147
    public function getOrderReference()
148
    {
149
        return $this->orderReference;
150
    }
151
152
    /**
153
     * @param string $orderReference
154
     *
155
     * @return $this
156
     */
157
    public function setOrderReference($orderReference)
158
    {
159
        $this->orderReference = $orderReference;
160
161
        return $this;
162
    }
163
164
    /**
165
     * @return string
166
     */
167
    public function getCountry()
168
    {
169
        return $this->country;
170
    }
171
172
    /**
173
     * @param string $country
174
     *
175
     * @return $this
176
     */
177
    public function setCountry($country)
178
    {
179
        $this->country = $country;
180
181
        return $this;
182
    }
183
184
    /**
185
     * @return string
186
     */
187
    public function getPostalCode()
188
    {
189
        return $this->postalCode;
190
    }
191
192
    /**
193
     * @param string $postalCode
194
     *
195
     * @return $this
196
     */
197
    public function setPostalCode($postalCode)
198
    {
199
        $this->postalCode = $postalCode;
200
201
        return $this;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getShippingOption()
208
    {
209
        return $this->shippingOption;
210
    }
211
212
    /**
213
     * @param string $shippingOption
214
     *
215
     * @return $this
216
     */
217
    public function setShippingOption($shippingOption)
218
    {
219
        $this->shippingOption = $shippingOption;
220
221
        return $this;
222
    }
223
}
224