Passed
Push — master ( 2b63db...3a2bd9 )
by Stefan
07:15
created

UpdatedAddress::__construct()   F

Complexity

Conditions 25
Paths > 20000

Size

Total Lines 75
Code Lines 48

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 75
rs 2.4533
cc 25
eloc 48
nc 6291457
nop 1

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Ups\Entity;
4
5
class UpdatedAddress
6
{
7
    /**
8
     * @var
9
     */
10
    public $AddressLine1;
11
12
    /**
13
     * @var
14
     */
15
    public $AddressLine2;
16
17
    /**
18
     * @var
19
     */
20
    public $AddressLine3;
21
22
    /**
23
     * @var
24
     */
25
    public $City;
26
27
    /**
28
     * @var
29
     */
30
    public $StateProvinceCode;
31
32
    /**
33
     * @var
34
     */
35
    public $PostalCode;
36
37
    /**
38
     * @var
39
     */
40
    public $CountryCode;
41
42
    /**
43
     * @var
44
     */
45
    public $PoliticalDivision1;
46
47
    /**
48
     * @var
49
     */
50
    public $PoliticalDivision2;
51
52
    /**
53
     * @var
54
     */
55
    public $PoliticalDivision3;
56
57
    /**
58
     * @var
59
     */
60
    public $PostcodePrimaryLow;
61
62
    /**
63
     * @var
64
     */
65
    public $PostcodePrimaryHigh;
66
67
    /**
68
     * @var
69
     */
70
    public $PostcodeExtendedLow;
71
72
    /**
73
     * @var
74
     */
75
    public $ResidentialAddressIndicator;
76
77
    /**
78
     * @var
79
     */
80
    public $ConsigneeName;
81
82
    /**
83
     * @var
84
     */
85
    public $StreetNumberLow;
86
87
    /**
88
     * @var
89
     */
90
    public $StreetPrefix;
91
92
    /**
93
     * @var
94
     */
95
    public $StreetName;
96
97
    /**
98
     * @var
99
     */
100
    public $StreetType;
101
102
    /**
103
     * @var
104
     */
105
    public $StreetSuffix;
106
107
    /**
108
     * @var
109
     */
110
    public $BuildingName;
111
112
    /**
113
     * @var array
114
     */
115
    public $AddressExtendedInformation;
116
117
    /**
118
     * @param null $response
119
     */
120
    public function __construct($response = null)
121
    {
122
        $this->AddressExtendedInformation = [];
123
124
        if (null != $response) {
125
            if (isset($response->AddressLine1)) {
126
                $this->AddressLine1 = $response->AddressLine1;
127
            }
128
            if (isset($response->AddressLine2)) {
129
                $this->AddressLine2 = $response->AddressLine2;
130
            }
131
            if (isset($response->AddressLine3)) {
132
                $this->AddressLine3 = $response->AddressLine3;
133
            }
134
            if (isset($response->City)) {
135
                $this->City = $response->City;
136
            }
137
            if (isset($response->StateProvinceCode)) {
138
                $this->StateProvinceCode = $response->StateProvinceCode;
139
            }
140
            if (isset($response->PostalCode)) {
141
                $this->PostalCode = $response->PostalCode;
142
            }
143
            if (isset($response->CountryCode)) {
144
                $this->CountryCode = $response->CountryCode;
145
            }
146
            if (isset($response->PoliticalDivision1)) {
147
                $this->PoliticalDivision1 = $response->PoliticalDivision1;
148
            }
149
            if (isset($response->PoliticalDivision2)) {
150
                $this->PoliticalDivision2 = $response->PoliticalDivision2;
151
            }
152
            if (isset($response->PoliticalDivision3)) {
153
                $this->PoliticalDivision3 = $response->PoliticalDivision3;
154
            }
155
            if (isset($response->PostcodePrimaryLow)) {
156
                $this->PostcodePrimaryLow = $response->PostcodePrimaryLow;
157
            }
158
            if (isset($response->PostcodePrimaryHigh)) {
159
                $this->PostcodePrimaryHigh = $response->PostcodePrimaryHigh;
160
            }
161
            if (isset($response->PostcodeExtendedLow)) {
162
                $this->PostcodeExtendedLow = $response->PostcodeExtendedLow;
163
            }
164
            if (isset($response->ResidentialAddressIndicator)) {
165
                $this->ResidentialAddressIndicator = $response->ResidentialAddressIndicator;
166
            }
167
            if (isset($response->ConsigneeName)) {
168
                $this->ConsigneeName = $response->ConsigneeName;
169
            }
170
            if (isset($response->StreetNumberLow)) {
171
                $this->StreetNumberLow = $response->StreetNumberLow;
172
            }
173
            if (isset($response->StreetPrefix)) {
174
                $this->StreetPrefix = $response->StreetPrefix;
175
            }
176
            if (isset($response->StreetName)) {
177
                $this->StreetName = $response->StreetName;
178
            }
179
            if (isset($response->StreetType)) {
180
                $this->StreetType = $response->StreetType;
181
            }
182
            if (isset($response->StreetSuffix)) {
183
                $this->StreetSuffix = $response->StreetSuffix;
184
            }
185
            if (isset($response->BuildingName)) {
186
                $this->BuildingName = $response->BuildingName;
187
            }
188
            if (isset($response->AddressExtendedInformation)) {
189
                foreach ($response->AddressExtendedInformation as $AddressExtendedInformation) {
190
                    $this->AddressExtendedInformation[] = new AddressExtendedInformation($AddressExtendedInformation);
191
                }
192
            }
193
        }
194
    }
195
}
196