| Total Complexity | 66 |
| Total Lines | 521 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like EwsPersonaPostalAddressType often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use EwsPersonaPostalAddressType, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 16 | class EwsPersonaPostalAddressType extends AbstractStructBase |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * The Street |
||
| 20 | * Meta information extracted from the WSDL |
||
| 21 | * - maxOccurs: 1 |
||
| 22 | * - minOccurs: 0 |
||
| 23 | * @var string|null |
||
| 24 | */ |
||
| 25 | protected ?string $Street = null; |
||
| 26 | /** |
||
| 27 | * The City |
||
| 28 | * Meta information extracted from the WSDL |
||
| 29 | * - maxOccurs: 1 |
||
| 30 | * - minOccurs: 0 |
||
| 31 | * @var string|null |
||
| 32 | */ |
||
| 33 | protected ?string $City = null; |
||
| 34 | /** |
||
| 35 | * The State |
||
| 36 | * Meta information extracted from the WSDL |
||
| 37 | * - maxOccurs: 1 |
||
| 38 | * - minOccurs: 0 |
||
| 39 | * @var string|null |
||
| 40 | */ |
||
| 41 | protected ?string $State = null; |
||
| 42 | /** |
||
| 43 | * The Country |
||
| 44 | * Meta information extracted from the WSDL |
||
| 45 | * - maxOccurs: 1 |
||
| 46 | * - minOccurs: 0 |
||
| 47 | * @var string|null |
||
| 48 | */ |
||
| 49 | protected ?string $Country = null; |
||
| 50 | /** |
||
| 51 | * The PostalCode |
||
| 52 | * Meta information extracted from the WSDL |
||
| 53 | * - maxOccurs: 1 |
||
| 54 | * - minOccurs: 0 |
||
| 55 | * @var string|null |
||
| 56 | */ |
||
| 57 | protected ?string $PostalCode = null; |
||
| 58 | /** |
||
| 59 | * The PostOfficeBox |
||
| 60 | * Meta information extracted from the WSDL |
||
| 61 | * - maxOccurs: 1 |
||
| 62 | * - minOccurs: 0 |
||
| 63 | * @var string|null |
||
| 64 | */ |
||
| 65 | protected ?string $PostOfficeBox = null; |
||
| 66 | /** |
||
| 67 | * The Type |
||
| 68 | * Meta information extracted from the WSDL |
||
| 69 | * - maxOccurs: 1 |
||
| 70 | * - minOccurs: 0 |
||
| 71 | * @var string|null |
||
| 72 | */ |
||
| 73 | protected ?string $Type = null; |
||
| 74 | /** |
||
| 75 | * The Latitude |
||
| 76 | * Meta information extracted from the WSDL |
||
| 77 | * - maxOccurs: 1 |
||
| 78 | * - minOccurs: 0 |
||
| 79 | * @var float|null |
||
| 80 | */ |
||
| 81 | protected ?float $Latitude = null; |
||
| 82 | /** |
||
| 83 | * The Longitude |
||
| 84 | * Meta information extracted from the WSDL |
||
| 85 | * - maxOccurs: 1 |
||
| 86 | * - minOccurs: 0 |
||
| 87 | * @var float|null |
||
| 88 | */ |
||
| 89 | protected ?float $Longitude = null; |
||
| 90 | /** |
||
| 91 | * The Accuracy |
||
| 92 | * Meta information extracted from the WSDL |
||
| 93 | * - maxOccurs: 1 |
||
| 94 | * - minOccurs: 0 |
||
| 95 | * @var float|null |
||
| 96 | */ |
||
| 97 | protected ?float $Accuracy = null; |
||
| 98 | /** |
||
| 99 | * The Altitude |
||
| 100 | * Meta information extracted from the WSDL |
||
| 101 | * - maxOccurs: 1 |
||
| 102 | * - minOccurs: 0 |
||
| 103 | * @var float|null |
||
| 104 | */ |
||
| 105 | protected ?float $Altitude = null; |
||
| 106 | /** |
||
| 107 | * The AltitudeAccuracy |
||
| 108 | * Meta information extracted from the WSDL |
||
| 109 | * - maxOccurs: 1 |
||
| 110 | * - minOccurs: 0 |
||
| 111 | * @var float|null |
||
| 112 | */ |
||
| 113 | protected ?float $AltitudeAccuracy = null; |
||
| 114 | /** |
||
| 115 | * The FormattedAddress |
||
| 116 | * Meta information extracted from the WSDL |
||
| 117 | * - maxOccurs: 1 |
||
| 118 | * - minOccurs: 0 |
||
| 119 | * @var string|null |
||
| 120 | */ |
||
| 121 | protected ?string $FormattedAddress = null; |
||
| 122 | /** |
||
| 123 | * The LocationUri |
||
| 124 | * Meta information extracted from the WSDL |
||
| 125 | * - maxOccurs: 1 |
||
| 126 | * - minOccurs: 0 |
||
| 127 | * @var string|null |
||
| 128 | */ |
||
| 129 | protected ?string $LocationUri = null; |
||
| 130 | /** |
||
| 131 | * The LocationSource |
||
| 132 | * Meta information extracted from the WSDL |
||
| 133 | * - maxOccurs: 1 |
||
| 134 | * - minOccurs: 0 |
||
| 135 | * @var string|null |
||
| 136 | */ |
||
| 137 | protected ?string $LocationSource = null; |
||
| 138 | /** |
||
| 139 | * Constructor method for PersonaPostalAddressType |
||
| 140 | * @uses EwsPersonaPostalAddressType::setStreet() |
||
| 141 | * @uses EwsPersonaPostalAddressType::setCity() |
||
| 142 | * @uses EwsPersonaPostalAddressType::setState() |
||
| 143 | * @uses EwsPersonaPostalAddressType::setCountry() |
||
| 144 | * @uses EwsPersonaPostalAddressType::setPostalCode() |
||
| 145 | * @uses EwsPersonaPostalAddressType::setPostOfficeBox() |
||
| 146 | * @uses EwsPersonaPostalAddressType::setType() |
||
| 147 | * @uses EwsPersonaPostalAddressType::setLatitude() |
||
| 148 | * @uses EwsPersonaPostalAddressType::setLongitude() |
||
| 149 | * @uses EwsPersonaPostalAddressType::setAccuracy() |
||
| 150 | * @uses EwsPersonaPostalAddressType::setAltitude() |
||
| 151 | * @uses EwsPersonaPostalAddressType::setAltitudeAccuracy() |
||
| 152 | * @uses EwsPersonaPostalAddressType::setFormattedAddress() |
||
| 153 | * @uses EwsPersonaPostalAddressType::setLocationUri() |
||
| 154 | * @uses EwsPersonaPostalAddressType::setLocationSource() |
||
| 155 | * @param string $street |
||
| 156 | * @param string $city |
||
| 157 | * @param string $state |
||
| 158 | * @param string $country |
||
| 159 | * @param string $postalCode |
||
| 160 | * @param string $postOfficeBox |
||
| 161 | * @param string $type |
||
| 162 | * @param float $latitude |
||
| 163 | * @param float $longitude |
||
| 164 | * @param float $accuracy |
||
| 165 | * @param float $altitude |
||
| 166 | * @param float $altitudeAccuracy |
||
| 167 | * @param string $formattedAddress |
||
| 168 | * @param string $locationUri |
||
| 169 | * @param string $locationSource |
||
| 170 | */ |
||
| 171 | public function __construct(?string $street = null, ?string $city = null, ?string $state = null, ?string $country = null, ?string $postalCode = null, ?string $postOfficeBox = null, ?string $type = null, ?float $latitude = null, ?float $longitude = null, ?float $accuracy = null, ?float $altitude = null, ?float $altitudeAccuracy = null, ?string $formattedAddress = null, ?string $locationUri = null, ?string $locationSource = null) |
||
| 189 | } |
||
| 190 | /** |
||
| 191 | * Get Street value |
||
| 192 | * @return string|null |
||
| 193 | */ |
||
| 194 | public function getStreet(): ?string |
||
| 195 | { |
||
| 196 | return $this->Street; |
||
| 197 | } |
||
| 198 | /** |
||
| 199 | * Set Street value |
||
| 200 | * @param string $street |
||
| 201 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 202 | */ |
||
| 203 | public function setStreet(?string $street = null): self |
||
| 204 | { |
||
| 205 | // validation for constraint: string |
||
| 206 | if (!is_null($street) && !is_string($street)) { |
||
|
|
|||
| 207 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($street, true), gettype($street)), __LINE__); |
||
| 208 | } |
||
| 209 | $this->Street = $street; |
||
| 210 | |||
| 211 | return $this; |
||
| 212 | } |
||
| 213 | /** |
||
| 214 | * Get City value |
||
| 215 | * @return string|null |
||
| 216 | */ |
||
| 217 | public function getCity(): ?string |
||
| 218 | { |
||
| 219 | return $this->City; |
||
| 220 | } |
||
| 221 | /** |
||
| 222 | * Set City value |
||
| 223 | * @param string $city |
||
| 224 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 225 | */ |
||
| 226 | public function setCity(?string $city = null): self |
||
| 235 | } |
||
| 236 | /** |
||
| 237 | * Get State value |
||
| 238 | * @return string|null |
||
| 239 | */ |
||
| 240 | public function getState(): ?string |
||
| 241 | { |
||
| 242 | return $this->State; |
||
| 243 | } |
||
| 244 | /** |
||
| 245 | * Set State value |
||
| 246 | * @param string $state |
||
| 247 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 248 | */ |
||
| 249 | public function setState(?string $state = null): self |
||
| 250 | { |
||
| 251 | // validation for constraint: string |
||
| 252 | if (!is_null($state) && !is_string($state)) { |
||
| 253 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($state, true), gettype($state)), __LINE__); |
||
| 254 | } |
||
| 255 | $this->State = $state; |
||
| 256 | |||
| 257 | return $this; |
||
| 258 | } |
||
| 259 | /** |
||
| 260 | * Get Country value |
||
| 261 | * @return string|null |
||
| 262 | */ |
||
| 263 | public function getCountry(): ?string |
||
| 264 | { |
||
| 265 | return $this->Country; |
||
| 266 | } |
||
| 267 | /** |
||
| 268 | * Set Country value |
||
| 269 | * @param string $country |
||
| 270 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 271 | */ |
||
| 272 | public function setCountry(?string $country = null): self |
||
| 273 | { |
||
| 274 | // validation for constraint: string |
||
| 275 | if (!is_null($country) && !is_string($country)) { |
||
| 276 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($country, true), gettype($country)), __LINE__); |
||
| 277 | } |
||
| 278 | $this->Country = $country; |
||
| 279 | |||
| 280 | return $this; |
||
| 281 | } |
||
| 282 | /** |
||
| 283 | * Get PostalCode value |
||
| 284 | * @return string|null |
||
| 285 | */ |
||
| 286 | public function getPostalCode(): ?string |
||
| 289 | } |
||
| 290 | /** |
||
| 291 | * Set PostalCode value |
||
| 292 | * @param string $postalCode |
||
| 293 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 294 | */ |
||
| 295 | public function setPostalCode(?string $postalCode = null): self |
||
| 296 | { |
||
| 297 | // validation for constraint: string |
||
| 298 | if (!is_null($postalCode) && !is_string($postalCode)) { |
||
| 299 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($postalCode, true), gettype($postalCode)), __LINE__); |
||
| 300 | } |
||
| 301 | $this->PostalCode = $postalCode; |
||
| 302 | |||
| 303 | return $this; |
||
| 304 | } |
||
| 305 | /** |
||
| 306 | * Get PostOfficeBox value |
||
| 307 | * @return string|null |
||
| 308 | */ |
||
| 309 | public function getPostOfficeBox(): ?string |
||
| 310 | { |
||
| 311 | return $this->PostOfficeBox; |
||
| 312 | } |
||
| 313 | /** |
||
| 314 | * Set PostOfficeBox value |
||
| 315 | * @param string $postOfficeBox |
||
| 316 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 317 | */ |
||
| 318 | public function setPostOfficeBox(?string $postOfficeBox = null): self |
||
| 319 | { |
||
| 320 | // validation for constraint: string |
||
| 321 | if (!is_null($postOfficeBox) && !is_string($postOfficeBox)) { |
||
| 322 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($postOfficeBox, true), gettype($postOfficeBox)), __LINE__); |
||
| 323 | } |
||
| 324 | $this->PostOfficeBox = $postOfficeBox; |
||
| 325 | |||
| 326 | return $this; |
||
| 327 | } |
||
| 328 | /** |
||
| 329 | * Get Type value |
||
| 330 | * @return string|null |
||
| 331 | */ |
||
| 332 | public function getType(): ?string |
||
| 333 | { |
||
| 334 | return $this->Type; |
||
| 335 | } |
||
| 336 | /** |
||
| 337 | * Set Type value |
||
| 338 | * @param string $type |
||
| 339 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 340 | */ |
||
| 341 | public function setType(?string $type = null): self |
||
| 342 | { |
||
| 343 | // validation for constraint: string |
||
| 344 | if (!is_null($type) && !is_string($type)) { |
||
| 345 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)), __LINE__); |
||
| 346 | } |
||
| 347 | $this->Type = $type; |
||
| 348 | |||
| 349 | return $this; |
||
| 350 | } |
||
| 351 | /** |
||
| 352 | * Get Latitude value |
||
| 353 | * @return float|null |
||
| 354 | */ |
||
| 355 | public function getLatitude(): ?float |
||
| 356 | { |
||
| 357 | return $this->Latitude; |
||
| 358 | } |
||
| 359 | /** |
||
| 360 | * Set Latitude value |
||
| 361 | * @param float $latitude |
||
| 362 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 363 | */ |
||
| 364 | public function setLatitude(?float $latitude = null): self |
||
| 365 | { |
||
| 366 | // validation for constraint: float |
||
| 367 | if (!is_null($latitude) && !(is_float($latitude) || is_numeric($latitude))) { |
||
| 368 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($latitude, true), gettype($latitude)), __LINE__); |
||
| 369 | } |
||
| 370 | $this->Latitude = $latitude; |
||
| 371 | |||
| 372 | return $this; |
||
| 373 | } |
||
| 374 | /** |
||
| 375 | * Get Longitude value |
||
| 376 | * @return float|null |
||
| 377 | */ |
||
| 378 | public function getLongitude(): ?float |
||
| 379 | { |
||
| 380 | return $this->Longitude; |
||
| 381 | } |
||
| 382 | /** |
||
| 383 | * Set Longitude value |
||
| 384 | * @param float $longitude |
||
| 385 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 386 | */ |
||
| 387 | public function setLongitude(?float $longitude = null): self |
||
| 388 | { |
||
| 389 | // validation for constraint: float |
||
| 390 | if (!is_null($longitude) && !(is_float($longitude) || is_numeric($longitude))) { |
||
| 391 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($longitude, true), gettype($longitude)), __LINE__); |
||
| 392 | } |
||
| 393 | $this->Longitude = $longitude; |
||
| 394 | |||
| 395 | return $this; |
||
| 396 | } |
||
| 397 | /** |
||
| 398 | * Get Accuracy value |
||
| 399 | * @return float|null |
||
| 400 | */ |
||
| 401 | public function getAccuracy(): ?float |
||
| 402 | { |
||
| 403 | return $this->Accuracy; |
||
| 404 | } |
||
| 405 | /** |
||
| 406 | * Set Accuracy value |
||
| 407 | * @param float $accuracy |
||
| 408 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 409 | */ |
||
| 410 | public function setAccuracy(?float $accuracy = null): self |
||
| 411 | { |
||
| 412 | // validation for constraint: float |
||
| 413 | if (!is_null($accuracy) && !(is_float($accuracy) || is_numeric($accuracy))) { |
||
| 414 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($accuracy, true), gettype($accuracy)), __LINE__); |
||
| 415 | } |
||
| 416 | $this->Accuracy = $accuracy; |
||
| 417 | |||
| 418 | return $this; |
||
| 419 | } |
||
| 420 | /** |
||
| 421 | * Get Altitude value |
||
| 422 | * @return float|null |
||
| 423 | */ |
||
| 424 | public function getAltitude(): ?float |
||
| 425 | { |
||
| 426 | return $this->Altitude; |
||
| 427 | } |
||
| 428 | /** |
||
| 429 | * Set Altitude value |
||
| 430 | * @param float $altitude |
||
| 431 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 432 | */ |
||
| 433 | public function setAltitude(?float $altitude = null): self |
||
| 434 | { |
||
| 435 | // validation for constraint: float |
||
| 436 | if (!is_null($altitude) && !(is_float($altitude) || is_numeric($altitude))) { |
||
| 437 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($altitude, true), gettype($altitude)), __LINE__); |
||
| 438 | } |
||
| 439 | $this->Altitude = $altitude; |
||
| 440 | |||
| 441 | return $this; |
||
| 442 | } |
||
| 443 | /** |
||
| 444 | * Get AltitudeAccuracy value |
||
| 445 | * @return float|null |
||
| 446 | */ |
||
| 447 | public function getAltitudeAccuracy(): ?float |
||
| 450 | } |
||
| 451 | /** |
||
| 452 | * Set AltitudeAccuracy value |
||
| 453 | * @param float $altitudeAccuracy |
||
| 454 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 455 | */ |
||
| 456 | public function setAltitudeAccuracy(?float $altitudeAccuracy = null): self |
||
| 457 | { |
||
| 458 | // validation for constraint: float |
||
| 459 | if (!is_null($altitudeAccuracy) && !(is_float($altitudeAccuracy) || is_numeric($altitudeAccuracy))) { |
||
| 460 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a float value, %s given', var_export($altitudeAccuracy, true), gettype($altitudeAccuracy)), __LINE__); |
||
| 461 | } |
||
| 462 | $this->AltitudeAccuracy = $altitudeAccuracy; |
||
| 463 | |||
| 464 | return $this; |
||
| 465 | } |
||
| 466 | /** |
||
| 467 | * Get FormattedAddress value |
||
| 468 | * @return string|null |
||
| 469 | */ |
||
| 470 | public function getFormattedAddress(): ?string |
||
| 473 | } |
||
| 474 | /** |
||
| 475 | * Set FormattedAddress value |
||
| 476 | * @param string $formattedAddress |
||
| 477 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 478 | */ |
||
| 479 | public function setFormattedAddress(?string $formattedAddress = null): self |
||
| 480 | { |
||
| 481 | // validation for constraint: string |
||
| 482 | if (!is_null($formattedAddress) && !is_string($formattedAddress)) { |
||
| 483 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($formattedAddress, true), gettype($formattedAddress)), __LINE__); |
||
| 484 | } |
||
| 485 | $this->FormattedAddress = $formattedAddress; |
||
| 486 | |||
| 487 | return $this; |
||
| 488 | } |
||
| 489 | /** |
||
| 490 | * Get LocationUri value |
||
| 491 | * @return string|null |
||
| 492 | */ |
||
| 493 | public function getLocationUri(): ?string |
||
| 494 | { |
||
| 495 | return $this->LocationUri; |
||
| 496 | } |
||
| 497 | /** |
||
| 498 | * Set LocationUri value |
||
| 499 | * @param string $locationUri |
||
| 500 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 501 | */ |
||
| 502 | public function setLocationUri(?string $locationUri = null): self |
||
| 503 | { |
||
| 504 | // validation for constraint: string |
||
| 505 | if (!is_null($locationUri) && !is_string($locationUri)) { |
||
| 506 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($locationUri, true), gettype($locationUri)), __LINE__); |
||
| 507 | } |
||
| 508 | $this->LocationUri = $locationUri; |
||
| 509 | |||
| 510 | return $this; |
||
| 511 | } |
||
| 512 | /** |
||
| 513 | * Get LocationSource value |
||
| 514 | * @return string|null |
||
| 515 | */ |
||
| 516 | public function getLocationSource(): ?string |
||
| 519 | } |
||
| 520 | /** |
||
| 521 | * Set LocationSource value |
||
| 522 | * @uses \EnumType\EwsLocationSourceType::valueIsValid() |
||
| 523 | * @uses \EnumType\EwsLocationSourceType::getValidValues() |
||
| 524 | * @throws InvalidArgumentException |
||
| 525 | * @param string $locationSource |
||
| 526 | * @return \StructType\EwsPersonaPostalAddressType |
||
| 527 | */ |
||
| 528 | public function setLocationSource(?string $locationSource = null): self |
||
| 537 | } |
||
| 538 | } |
||
| 539 |