GoogleMapSearchstringRequest   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 233
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 233
loc 233
rs 10
c 0
b 0
f 0
wmc 17

17 Methods

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