AddressType   A
last analyzed

Complexity

Total Complexity 19

Size/Duplication

Total Lines 261
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 261
loc 261
rs 10
c 0
b 0
f 0
wmc 19

19 Methods

Rating   Name   Duplication   Size   Complexity  
A getAddress() 3 3 1
A setAdditionalAddressLine() 5 5 1
A setCity() 5 5 1
A setStreet() 5 5 1
A setAddition() 5 5 1
A __construct() 11 11 1
A getPostcode() 3 3 1
A getStreet() 3 3 1
A setPostcode() 5 5 1
A getCountry() 3 3 1
A getCity() 3 3 1
A getProvince() 3 3 1
A setHousenumber() 5 5 1
A setAddress() 5 5 1
A getHousenumber() 3 3 1
A getAddition() 3 3 1
A setCountry() 5 5 1
A setProvince() 5 5 1
A getAdditionalAddressLine() 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 View Code Duplication
class AddressType
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...
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $street = null;
21
22
    /**
23
     * @var string
24
     */
25
    protected $housenumber = null;
26
27
    /**
28
     * @var string
29
     */
30
    protected $addition = null;
31
32
    /**
33
     * @var string
34
     */
35
    protected $address = null;
36
37
    /**
38
     * @var string
39
     */
40
    protected $additionalAddressLine = null;
41
42
    /**
43
     * @var string
44
     */
45
    protected $postcode = null;
46
47
    /**
48
     * @var string
49
     */
50
    protected $city = null;
51
52
    /**
53
     * @var string
54
     */
55
    protected $province = null;
56
57
    /**
58
     * @var string
59
     */
60
    protected $country = null;
61
62
    /**
63
     * Constructor.
64
     *
65
     * @var string
66
     * @var string $housenumber
67
     * @var string $addition
68
     * @var string $address
69
     * @var string $additionalAddressLine
70
     * @var string $postcode
71
     * @var string $city
72
     * @var string $province
73
     * @var string $country
74
     *
75
     * @param mixed $street
76
     * @param mixed $housenumber
77
     * @param mixed $addition
78
     * @param mixed $address
79
     * @param mixed $additionalAddressLine
80
     * @param mixed $postcode
81
     * @param mixed $city
82
     * @param mixed $province
83
     * @param mixed $country
84
     */
85
    public function __construct($street, $housenumber, $addition, $address, $additionalAddressLine, $postcode, $city, $province, $country)
86
    {
87
        $this->street = $street;
0 ignored issues
show
Documentation Bug introduced by
$street is of type mixed, but the property $street 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...
88
        $this->housenumber = $housenumber;
89
        $this->addition = $addition;
90
        $this->address = $address;
91
        $this->additionalAddressLine = $additionalAddressLine;
92
        $this->postcode = $postcode;
93
        $this->city = $city;
94
        $this->province = $province;
95
        $this->country = $country;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getStreet()
102
    {
103
        return $this->street;
104
    }
105
106
    /**
107
     * @param string $street
108
     *
109
     * @return $this
110
     */
111
    public function setStreet($street)
112
    {
113
        $this->street = $street;
114
115
        return $this;
116
    }
117
118
    /**
119
     * @return string
120
     */
121
    public function getHousenumber()
122
    {
123
        return $this->housenumber;
124
    }
125
126
    /**
127
     * @param string $housenumber
128
     *
129
     * @return $this
130
     */
131
    public function setHousenumber($housenumber)
132
    {
133
        $this->housenumber = $housenumber;
134
135
        return $this;
136
    }
137
138
    /**
139
     * @return string
140
     */
141
    public function getAddition()
142
    {
143
        return $this->addition;
144
    }
145
146
    /**
147
     * @param string $addition
148
     *
149
     * @return $this
150
     */
151
    public function setAddition($addition)
152
    {
153
        $this->addition = $addition;
154
155
        return $this;
156
    }
157
158
    /**
159
     * @return string
160
     */
161
    public function getAddress()
162
    {
163
        return $this->address;
164
    }
165
166
    /**
167
     * @param string $address
168
     *
169
     * @return $this
170
     */
171
    public function setAddress($address)
172
    {
173
        $this->address = $address;
174
175
        return $this;
176
    }
177
178
    /**
179
     * @return string
180
     */
181
    public function getAdditionalAddressLine()
182
    {
183
        return $this->additionalAddressLine;
184
    }
185
186
    /**
187
     * @param string $additionalAddressLine
188
     *
189
     * @return $this
190
     */
191
    public function setAdditionalAddressLine($additionalAddressLine)
192
    {
193
        $this->additionalAddressLine = $additionalAddressLine;
194
195
        return $this;
196
    }
197
198
    /**
199
     * @return string
200
     */
201
    public function getPostcode()
202
    {
203
        return $this->postcode;
204
    }
205
206
    /**
207
     * @param string $postcode
208
     *
209
     * @return $this
210
     */
211
    public function setPostcode($postcode)
212
    {
213
        $this->postcode = $postcode;
214
215
        return $this;
216
    }
217
218
    /**
219
     * @return string
220
     */
221
    public function getCity()
222
    {
223
        return $this->city;
224
    }
225
226
    /**
227
     * @param string $city
228
     *
229
     * @return $this
230
     */
231
    public function setCity($city)
232
    {
233
        $this->city = $city;
234
235
        return $this;
236
    }
237
238
    /**
239
     * @return string
240
     */
241
    public function getProvince()
242
    {
243
        return $this->province;
244
    }
245
246
    /**
247
     * @param string $province
248
     *
249
     * @return $this
250
     */
251
    public function setProvince($province)
252
    {
253
        $this->province = $province;
254
255
        return $this;
256
    }
257
258
    /**
259
     * @return string
260
     */
261
    public function getCountry()
262
    {
263
        return $this->country;
264
    }
265
266
    /**
267
     * @param string $country
268
     *
269
     * @return $this
270
     */
271
    public function setCountry($country)
272
    {
273
        $this->country = $country;
274
275
        return $this;
276
    }
277
}
278