| Conditions | 25 |
| Paths | > 20000 |
| Total Lines | 75 |
| Code Lines | 48 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
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:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 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 |