Complex classes like PhoneMetadata 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 PhoneMetadata, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 10 | class PhoneMetadata |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $id = null; |
||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | protected $countryCode = null; |
||
| 20 | protected $leadingDigits = null; |
||
| 21 | protected $internationalPrefix = null; |
||
| 22 | protected $preferredInternationalPrefix = null; |
||
| 23 | protected $nationalPrefixForParsing = null; |
||
| 24 | protected $nationalPrefixTransformRule = null; |
||
| 25 | protected $nationalPrefix = null; |
||
| 26 | protected $preferredExtnPrefix = null; |
||
| 27 | protected $mainCountryForCode = false; |
||
| 28 | protected $leadingZeroPossible = false; |
||
| 29 | protected $mobileNumberPortableRegion = false; |
||
| 30 | protected $generalDesc = null; |
||
| 31 | /** |
||
| 32 | * @var PhoneNumberDesc |
||
| 33 | */ |
||
| 34 | protected $mobile = null; |
||
| 35 | protected $premiumRate = null; |
||
| 36 | protected $fixedLine = null; |
||
| 37 | protected $sameMobileAndFixedLinePattern = false; |
||
| 38 | protected $numberFormat = array(); |
||
| 39 | protected $tollFree = null; |
||
| 40 | protected $sharedCost = null; |
||
| 41 | protected $personalNumber; |
||
| 42 | protected $voip; |
||
| 43 | protected $pager; |
||
| 44 | protected $uan; |
||
| 45 | protected $emergency; |
||
| 46 | protected $voicemail; |
||
| 47 | /** |
||
| 48 | * @var PhoneNumberDesc |
||
| 49 | */ |
||
| 50 | protected $short_code; |
||
| 51 | /** |
||
| 52 | * @var PhoneNumberDesc |
||
| 53 | */ |
||
| 54 | protected $standard_rate; |
||
| 55 | /** |
||
| 56 | * @var PhoneNumberDesc |
||
| 57 | */ |
||
| 58 | protected $carrierSpecific; |
||
| 59 | /** |
||
| 60 | * @var PhoneNumberDesc |
||
| 61 | */ |
||
| 62 | protected $noInternationalDialling = null; |
||
| 63 | /** |
||
| 64 | * |
||
| 65 | * @var NumberFormat[] |
||
| 66 | */ |
||
| 67 | protected $intlNumberFormat = array(); |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return boolean |
||
| 71 | */ |
||
| 72 | public function hasId() |
||
| 73 | { |
||
| 74 | return isset($this->id); |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @return boolean |
||
| 79 | */ |
||
| 80 | 482 | public function hasCountryCode() |
|
| 81 | { |
||
| 82 | 482 | return isset($this->countryCode); |
|
| 83 | } |
||
| 84 | |||
| 85 | 482 | public function hasInternationalPrefix() |
|
| 86 | { |
||
| 87 | 482 | return isset($this->internationalPrefix); |
|
| 88 | } |
||
| 89 | |||
| 90 | public function hasMainCountryForCode() |
||
| 91 | { |
||
| 92 | return isset($this->mainCountryForCode); |
||
| 93 | } |
||
| 94 | |||
| 95 | 2 | public function isMainCountryForCode() |
|
| 99 | |||
| 100 | 482 | public function getMainCountryForCode() |
|
| 101 | { |
||
| 102 | 482 | return $this->mainCountryForCode; |
|
| 103 | } |
||
| 104 | |||
| 105 | 1349 | public function setMainCountryForCode($value) |
|
| 110 | |||
| 111 | 1 | public function clearMainCountryForCode() |
|
| 112 | { |
||
| 113 | 1 | $this->mainCountryForCode = false; |
|
| 114 | 1 | return $this; |
|
| 115 | } |
||
| 116 | |||
| 117 | 482 | public function hasLeadingZeroPossible() |
|
| 121 | |||
| 122 | 482 | public function hasMobileNumberPortableRegion() |
|
| 126 | |||
| 127 | 483 | public function hasSameMobileAndFixedLinePattern() |
|
| 131 | |||
| 132 | 2 | public function numberFormatSize() |
|
| 136 | |||
| 137 | /** |
||
| 138 | * @param int $index |
||
| 139 | * @return NumberFormat |
||
| 140 | */ |
||
| 141 | 11 | public function getNumberFormat($index) |
|
| 145 | |||
| 146 | public function intlNumberFormatSize() |
||
| 150 | |||
| 151 | 6 | public function getIntlNumberFormat($index) |
|
| 155 | |||
| 156 | 7 | public function clearIntlNumberFormat() |
|
| 161 | |||
| 162 | 482 | public function toArray() |
|
| 163 | { |
||
| 164 | 482 | $output = array(); |
|
| 165 | |||
| 166 | 482 | if ($this->hasGeneralDesc()) { |
|
| 167 | 482 | $output['generalDesc'] = $this->getGeneralDesc()->toArray(); |
|
| 168 | 482 | } |
|
| 169 | |||
| 170 | 482 | if ($this->hasFixedLine()) { |
|
| 171 | 244 | $output['fixedLine'] = $this->getFixedLine()->toArray(); |
|
| 172 | 244 | } |
|
| 173 | |||
| 174 | 482 | if ($this->hasMobile()) { |
|
| 175 | 244 | $output['mobile'] = $this->getMobile()->toArray(); |
|
| 176 | 244 | } |
|
| 177 | |||
| 178 | 482 | if ($this->hasTollFree()) { |
|
| 179 | 482 | $output['tollFree'] = $this->getTollFree()->toArray(); |
|
| 180 | 482 | } |
|
| 181 | |||
| 182 | 482 | if ($this->hasPremiumRate()) { |
|
| 183 | 482 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
|
| 184 | 482 | } |
|
| 185 | |||
| 186 | 482 | if ($this->hasPremiumRate()) { |
|
| 187 | 482 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
|
| 188 | 482 | } |
|
| 189 | |||
| 190 | 482 | if ($this->hasSharedCost()) { |
|
| 191 | 244 | $output['sharedCost'] = $this->getSharedCost()->toArray(); |
|
| 192 | 244 | } |
|
| 193 | |||
| 194 | 482 | if ($this->hasPersonalNumber()) { |
|
| 195 | 244 | $output['personalNumber'] = $this->getPersonalNumber()->toArray(); |
|
| 196 | 244 | } |
|
| 197 | |||
| 198 | 482 | if ($this->hasVoip()) { |
|
| 199 | 244 | $output['voip'] = $this->getVoip()->toArray(); |
|
| 200 | 244 | } |
|
| 201 | |||
| 202 | 482 | if ($this->hasPager()) { |
|
| 203 | 244 | $output['pager'] = $this->getPager()->toArray(); |
|
| 204 | 244 | } |
|
| 205 | |||
| 206 | 482 | if ($this->hasUan()) { |
|
| 207 | 244 | $output['uan'] = $this->getUan()->toArray(); |
|
| 208 | 244 | } |
|
| 209 | |||
| 210 | 482 | if ($this->hasEmergency()) { |
|
| 211 | 238 | $output['emergency'] = $this->getEmergency()->toArray(); |
|
| 212 | 238 | } |
|
| 213 | |||
| 214 | 482 | if ($this->hasVoicemail()) { |
|
| 215 | 244 | $output['voicemail'] = $this->getVoicemail()->toArray(); |
|
| 216 | 244 | } |
|
| 217 | |||
| 218 | 482 | if ($this->hasShortCode()) { |
|
| 219 | 238 | $output['shortCode'] = $this->getShortCode()->toArray(); |
|
| 220 | 238 | } |
|
| 221 | |||
| 222 | 482 | if ($this->hasStandardRate()) { |
|
| 223 | 238 | $output['standardRate'] = $this->getStandardRate()->toArray(); |
|
| 224 | 238 | } |
|
| 225 | |||
| 226 | 482 | if ($this->hasCarrierSpecific()) { |
|
| 227 | 238 | $output['carrierSpecific'] = $this->getCarrierSpecific()->toArray(); |
|
| 228 | 238 | } |
|
| 229 | |||
| 230 | 482 | if ($this->hasNoInternationalDialling()) { |
|
| 231 | 244 | $output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray(); |
|
| 232 | 244 | } |
|
| 233 | |||
| 234 | 482 | $output['id'] = $this->getId(); |
|
| 235 | 482 | if ($this->hasCountryCode()) { |
|
| 236 | 482 | $output['countryCode'] = $this->getCountryCode(); |
|
| 237 | 482 | } |
|
| 238 | |||
| 239 | 482 | if ($this->hasInternationalPrefix()) { |
|
| 240 | 482 | $output['internationalPrefix'] = $this->getInternationalPrefix(); |
|
| 241 | 482 | } |
|
| 242 | |||
| 243 | 482 | if ($this->hasPreferredInternationalPrefix()) { |
|
| 244 | 22 | $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix(); |
|
| 245 | 22 | } |
|
| 246 | |||
| 247 | 482 | if ($this->hasNationalPrefix()) { |
|
| 248 | 146 | $output['nationalPrefix'] = $this->getNationalPrefix(); |
|
| 249 | 146 | } |
|
| 250 | |||
| 251 | 482 | if ($this->hasPreferredExtnPrefix()) { |
|
| 252 | 8 | $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix(); |
|
| 253 | 8 | } |
|
| 254 | |||
| 255 | 482 | if ($this->hasNationalPrefixForParsing()) { |
|
| 256 | 151 | $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing(); |
|
| 257 | 151 | } |
|
| 258 | |||
| 259 | 482 | if ($this->hasNationalPrefixTransformRule()) { |
|
| 260 | 4 | $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule(); |
|
| 261 | 4 | } |
|
| 262 | |||
| 263 | 482 | if ($this->hasSameMobileAndFixedLinePattern()) { |
|
| 264 | 482 | $output['sameMobileAndFixedLinePattern'] = $this->isSameMobileAndFixedLinePattern(); |
|
| 265 | 482 | } |
|
| 266 | |||
| 267 | 482 | $output['numberFormat'] = array(); |
|
| 268 | 482 | foreach ($this->numberFormats() as $numberFormat) { |
|
| 269 | 198 | $output['numberFormat'][] = $numberFormat->toArray(); |
|
| 270 | 482 | } |
|
| 271 | |||
| 272 | 482 | $output['intlNumberFormat'] = array(); |
|
| 273 | 482 | foreach ($this->intlNumberFormats() as $intlNumberFormat) { |
|
| 274 | 15 | $output['intlNumberFormat'][] = $intlNumberFormat->toArray(); |
|
| 275 | 482 | } |
|
| 276 | |||
| 277 | 482 | $output['mainCountryForCode'] = $this->getMainCountryForCode(); |
|
| 278 | |||
| 279 | 482 | if ($this->hasLeadingDigits()) { |
|
| 280 | 26 | $output['leadingDigits'] = $this->getLeadingDigits(); |
|
| 281 | 26 | } |
|
| 282 | |||
| 283 | 482 | if ($this->hasLeadingZeroPossible()) { |
|
| 284 | 482 | $output['leadingZeroPossible'] = $this->isLeadingZeroPossible(); |
|
| 285 | 482 | } |
|
| 286 | |||
| 287 | 482 | if ($this->hasMobileNumberPortableRegion()) { |
|
| 288 | 482 | $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion(); |
|
| 289 | 482 | } |
|
| 290 | |||
| 291 | 482 | return $output; |
|
| 292 | } |
||
| 293 | |||
| 294 | 485 | public function hasGeneralDesc() |
|
| 298 | |||
| 299 | /** |
||
| 300 | * @return PhoneNumberDesc |
||
| 301 | */ |
||
| 302 | 3266 | public function getGeneralDesc() |
|
| 306 | |||
| 307 | 1357 | public function setGeneralDesc(PhoneNumberDesc $value) |
|
| 312 | |||
| 313 | 485 | public function hasFixedLine() |
|
| 317 | |||
| 318 | /** |
||
| 319 | * @return PhoneNumberDesc |
||
| 320 | */ |
||
| 321 | 1767 | public function getFixedLine() |
|
| 325 | |||
| 326 | 860 | public function setFixedLine(PhoneNumberDesc $value) |
|
| 331 | |||
| 332 | 485 | public function hasMobile() |
|
| 336 | |||
| 337 | /** |
||
| 338 | * @return PhoneNumberDesc |
||
| 339 | */ |
||
| 340 | 1375 | public function getMobile() |
|
| 344 | |||
| 345 | 860 | public function setMobile(PhoneNumberDesc $value) |
|
| 350 | |||
| 351 | 485 | public function hasTollFree() |
|
| 355 | |||
| 356 | /** |
||
| 357 | * @return PhoneNumberDesc |
||
| 358 | */ |
||
| 359 | 2635 | public function getTollFree() |
|
| 363 | |||
| 364 | 1354 | public function setTollFree(PhoneNumberDesc $value) |
|
| 369 | |||
| 370 | 485 | public function hasPremiumRate() |
|
| 374 | |||
| 375 | /** |
||
| 376 | * @return PhoneNumberDesc |
||
| 377 | */ |
||
| 378 | 2863 | public function getPremiumRate() |
|
| 382 | |||
| 383 | 1354 | public function setPremiumRate(PhoneNumberDesc $value) |
|
| 388 | |||
| 389 | 485 | public function hasSharedCost() |
|
| 393 | |||
| 394 | /** |
||
| 395 | * @return PhoneNumberDesc |
||
| 396 | */ |
||
| 397 | 1851 | public function getSharedCost() |
|
| 401 | |||
| 402 | 860 | public function setSharedCost(PhoneNumberDesc $value) |
|
| 407 | |||
| 408 | 485 | public function hasPersonalNumber() |
|
| 412 | |||
| 413 | /** |
||
| 414 | * @return PhoneNumberDesc |
||
| 415 | */ |
||
| 416 | 1706 | public function getPersonalNumber() |
|
| 420 | |||
| 421 | 860 | public function setPersonalNumber(PhoneNumberDesc $value) |
|
| 426 | |||
| 427 | 485 | public function hasVoip() |
|
| 431 | |||
| 432 | /** |
||
| 433 | * @return PhoneNumberDesc |
||
| 434 | */ |
||
| 435 | 1769 | public function getVoip() |
|
| 439 | |||
| 440 | 860 | public function setVoip(PhoneNumberDesc $value) |
|
| 445 | |||
| 446 | 485 | public function hasPager() |
|
| 450 | |||
| 451 | /** |
||
| 452 | * @return PhoneNumberDesc |
||
| 453 | */ |
||
| 454 | 1681 | public function getPager() |
|
| 458 | |||
| 459 | 860 | public function setPager(PhoneNumberDesc $value) |
|
| 464 | |||
| 465 | 485 | public function hasUan() |
|
| 469 | |||
| 470 | /** |
||
| 471 | * @return PhoneNumberDesc |
||
| 472 | */ |
||
| 473 | 1628 | public function getUan() |
|
| 477 | |||
| 478 | 860 | public function setUan(PhoneNumberDesc $value) |
|
| 483 | |||
| 484 | 759 | public function hasEmergency() |
|
| 488 | |||
| 489 | /** |
||
| 490 | * @return PhoneNumberDesc |
||
| 491 | */ |
||
| 492 | 513 | public function getEmergency() |
|
| 496 | |||
| 497 | 501 | public function setEmergency(PhoneNumberDesc $value) |
|
| 502 | |||
| 503 | 485 | public function hasVoicemail() |
|
| 507 | |||
| 508 | /** |
||
| 509 | * @return PhoneNumberDesc |
||
| 510 | */ |
||
| 511 | 1612 | public function getVoicemail() |
|
| 515 | |||
| 516 | 860 | public function setVoicemail(PhoneNumberDesc $value) |
|
| 521 | |||
| 522 | 485 | public function hasShortCode() |
|
| 526 | |||
| 527 | 489 | public function getShortCode() |
|
| 531 | |||
| 532 | 501 | public function setShortCode(PhoneNumberDesc $value) |
|
| 537 | |||
| 538 | 485 | public function hasStandardRate() |
|
| 542 | |||
| 543 | 766 | public function getStandardRate() |
|
| 547 | |||
| 548 | 501 | public function setStandardRate(PhoneNumberDesc $value) |
|
| 553 | |||
| 554 | 485 | public function hasCarrierSpecific() |
|
| 558 | |||
| 559 | 477 | public function getCarrierSpecific() |
|
| 563 | |||
| 564 | 501 | public function setCarrierSpecific(PhoneNumberDesc $value) |
|
| 569 | |||
| 570 | 485 | public function hasNoInternationalDialling() |
|
| 574 | |||
| 575 | 493 | public function getNoInternationalDialling() |
|
| 579 | |||
| 580 | 860 | public function setNoInternationalDialling(PhoneNumberDesc $value) |
|
| 585 | |||
| 586 | /** |
||
| 587 | * @return string |
||
| 588 | */ |
||
| 589 | 497 | public function getId() |
|
| 593 | |||
| 594 | /** |
||
| 595 | * @param string $value |
||
| 596 | * @return PhoneMetadata |
||
| 597 | */ |
||
| 598 | 1358 | public function setId($value) |
|
| 603 | |||
| 604 | /** |
||
| 605 | * @return int |
||
| 606 | */ |
||
| 607 | 3217 | public function getCountryCode() |
|
| 611 | |||
| 612 | /** |
||
| 613 | * @param int $value |
||
| 614 | * @return PhoneMetadata |
||
| 615 | */ |
||
| 616 | 1358 | public function setCountryCode($value) |
|
| 621 | |||
| 622 | 3210 | public function getInternationalPrefix() |
|
| 626 | |||
| 627 | 1358 | public function setInternationalPrefix($value) |
|
| 632 | |||
| 633 | 485 | public function hasPreferredInternationalPrefix() |
|
| 637 | |||
| 638 | 27 | public function getPreferredInternationalPrefix() |
|
| 642 | |||
| 643 | 85 | public function setPreferredInternationalPrefix($value) |
|
| 648 | |||
| 649 | 1 | public function clearPreferredInternationalPrefix() |
|
| 654 | |||
| 655 | 484 | public function hasNationalPrefix() |
|
| 659 | |||
| 660 | 154 | public function getNationalPrefix() |
|
| 664 | |||
| 665 | 539 | public function setNationalPrefix($value) |
|
| 670 | |||
| 671 | public function clearNationalPrefix() |
||
| 676 | |||
| 677 | 484 | public function hasPreferredExtnPrefix() |
|
| 681 | |||
| 682 | 10 | public function getPreferredExtnPrefix() |
|
| 686 | |||
| 687 | 93 | public function setPreferredExtnPrefix($value) |
|
| 692 | |||
| 693 | 1 | public function clearPreferredExtnPrefix() |
|
| 698 | |||
| 699 | 485 | public function hasNationalPrefixForParsing() |
|
| 703 | |||
| 704 | 2891 | public function getNationalPrefixForParsing() |
|
| 708 | |||
| 709 | 555 | public function setNationalPrefixForParsing($value) |
|
| 714 | |||
| 715 | 482 | public function hasNationalPrefixTransformRule() |
|
| 719 | |||
| 720 | 77 | public function getNationalPrefixTransformRule() |
|
| 724 | |||
| 725 | 33 | public function setNationalPrefixTransformRule($value) |
|
| 730 | |||
| 731 | 1 | public function clearNationalPrefixTransformRule() |
|
| 736 | |||
| 737 | 1603 | public function isSameMobileAndFixedLinePattern() |
|
| 741 | |||
| 742 | 5 | public function setSameMobileAndFixedLinePattern($value) |
|
| 747 | |||
| 748 | 1 | public function clearSameMobileAndFixedLinePattern() |
|
| 753 | |||
| 754 | /** |
||
| 755 | * @return NumberFormat[] |
||
| 756 | */ |
||
| 757 | 523 | public function numberFormats() |
|
| 761 | |||
| 762 | 526 | public function intlNumberFormats() |
|
| 766 | |||
| 767 | /** |
||
| 768 | * @return bool |
||
| 769 | */ |
||
| 770 | 1003 | public function hasLeadingDigits() |
|
| 774 | |||
| 775 | 201 | public function getLeadingDigits() |
|
| 779 | |||
| 780 | 80 | public function setLeadingDigits($value) |
|
| 785 | |||
| 786 | 486 | public function isLeadingZeroPossible() |
|
| 790 | |||
| 791 | 1349 | public function setLeadingZeroPossible($value) |
|
| 796 | |||
| 797 | 1 | public function clearLeadingZeroPossible() |
|
| 802 | |||
| 803 | 487 | public function isMobileNumberPortableRegion() |
|
| 807 | |||
| 808 | 1349 | public function setMobileNumberPortableRegion($value) |
|
| 813 | |||
| 814 | 1 | public function clearMobileNumberPortableRegion() |
|
| 819 | |||
| 820 | /** |
||
| 821 | * @param array $input |
||
| 822 | * @return PhoneMetadata |
||
| 823 | */ |
||
| 824 | 1348 | public function fromArray(array $input) |
|
| 825 | { |
||
| 826 | 1348 | if (isset($input['generalDesc'])) { |
|
| 827 | 1348 | $desc = new PhoneNumberDesc(); |
|
| 828 | 1348 | $this->setGeneralDesc($desc->fromArray($input['generalDesc'])); |
|
| 829 | 1348 | } |
|
| 830 | |||
| 831 | 1348 | if (isset($input['fixedLine'])) { |
|
| 832 | 855 | $desc = new PhoneNumberDesc(); |
|
| 833 | 855 | $this->setFixedLine($desc->fromArray($input['fixedLine'])); |
|
| 834 | 855 | } |
|
| 835 | |||
| 836 | 1348 | if (isset($input['mobile'])) { |
|
| 837 | 855 | $desc = new PhoneNumberDesc(); |
|
| 838 | 855 | $this->setMobile($desc->fromArray($input['mobile'])); |
|
| 839 | 855 | } |
|
| 840 | |||
| 841 | 1348 | if (isset($input['tollFree'])) { |
|
| 842 | 1348 | $desc = new PhoneNumberDesc(); |
|
| 843 | 1348 | $this->setTollFree($desc->fromArray($input['tollFree'])); |
|
| 844 | 1348 | } |
|
| 845 | |||
| 846 | 1348 | if (isset($input['premiumRate'])) { |
|
| 847 | 1348 | $desc = new PhoneNumberDesc(); |
|
| 848 | 1348 | $this->setPremiumRate($desc->fromArray($input['premiumRate'])); |
|
| 849 | 1348 | } |
|
| 850 | |||
| 851 | 1348 | if (isset($input['sharedCost'])) { |
|
| 852 | 855 | $desc = new PhoneNumberDesc(); |
|
| 853 | 855 | $this->setSharedCost($desc->fromArray($input['sharedCost'])); |
|
| 854 | 855 | } |
|
| 855 | |||
| 856 | 1348 | if (isset($input['personalNumber'])) { |
|
| 857 | 855 | $desc = new PhoneNumberDesc(); |
|
| 858 | 855 | $this->setPersonalNumber($desc->fromArray($input['personalNumber'])); |
|
| 859 | 855 | } |
|
| 860 | |||
| 861 | 1348 | if (isset($input['voip'])) { |
|
| 862 | 855 | $desc = new PhoneNumberDesc(); |
|
| 863 | 855 | $this->setVoip($desc->fromArray($input['voip'])); |
|
| 864 | 855 | } |
|
| 865 | |||
| 866 | 1348 | if (isset($input['pager'])) { |
|
| 867 | 855 | $desc = new PhoneNumberDesc(); |
|
| 868 | 855 | $this->setPager($desc->fromArray($input['pager'])); |
|
| 869 | 855 | } |
|
| 870 | |||
| 871 | 1348 | if (isset($input['uan'])) { |
|
| 872 | 855 | $desc = new PhoneNumberDesc(); |
|
| 873 | 855 | $this->setUan($desc->fromArray($input['uan'])); |
|
| 874 | 855 | } |
|
| 875 | |||
| 876 | 1348 | if (isset($input['emergency'])) { |
|
| 877 | 500 | $desc = new PhoneNumberDesc(); |
|
| 878 | 500 | $this->setEmergency($desc->fromArray($input['emergency'])); |
|
| 879 | 500 | } |
|
| 880 | |||
| 881 | 1348 | if (isset($input['voicemail'])) { |
|
| 882 | 855 | $desc = new PhoneNumberDesc(); |
|
| 883 | 855 | $this->setVoicemail($desc->fromArray($input['voicemail'])); |
|
| 884 | 855 | } |
|
| 885 | |||
| 886 | 1348 | if (isset($input['shortCode'])) { |
|
| 887 | 500 | $desc = new PhoneNumberDesc(); |
|
| 888 | 500 | $this->setShortCode(($desc->fromArray($input['shortCode']))); |
|
| 889 | 500 | } |
|
| 890 | |||
| 891 | 1348 | if (isset($input['standardRate'])) { |
|
| 892 | 500 | $desc = new PhoneNumberDesc(); |
|
| 893 | 500 | $this->setStandardRate($desc->fromArray($input['standardRate'])); |
|
| 894 | 500 | } |
|
| 895 | |||
| 896 | 1348 | if (isset($input['carrierSpecific'])) { |
|
| 897 | 500 | $desc = new PhoneNumberDesc(); |
|
| 898 | 500 | $this->setCarrierSpecific($desc->fromArray($input['carrierSpecific'])); |
|
| 899 | 500 | } |
|
| 900 | |||
| 901 | 1348 | if (isset($input['noInternationalDialling'])) { |
|
| 902 | 855 | $desc = new PhoneNumberDesc(); |
|
| 903 | 855 | $this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling'])); |
|
| 904 | 855 | } |
|
| 905 | |||
| 906 | 1348 | $this->setId($input['id']); |
|
| 907 | 1348 | $this->setCountryCode($input['countryCode']); |
|
| 908 | 1348 | $this->setInternationalPrefix($input['internationalPrefix']); |
|
| 909 | |||
| 910 | 1348 | if (isset($input['preferredInternationalPrefix'])) { |
|
| 911 | 84 | $this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']); |
|
| 912 | 84 | } |
|
| 913 | 1348 | if (isset($input['nationalPrefix'])) { |
|
| 914 | 536 | $this->setNationalPrefix($input['nationalPrefix']); |
|
| 915 | 536 | } |
|
| 916 | 1348 | if (isset($input['nationalPrefix'])) { |
|
| 917 | 536 | $this->setNationalPrefix($input['nationalPrefix']); |
|
| 918 | 536 | } |
|
| 919 | |||
| 920 | 1348 | if (isset($input['preferredExtnPrefix'])) { |
|
| 921 | 92 | $this->setPreferredExtnPrefix($input['preferredExtnPrefix']); |
|
| 922 | 92 | } |
|
| 923 | |||
| 924 | 1348 | if (isset($input['nationalPrefixForParsing'])) { |
|
| 925 | 551 | $this->setNationalPrefixForParsing($input['nationalPrefixForParsing']); |
|
| 926 | 551 | } |
|
| 927 | |||
| 928 | 1348 | if (isset($input['nationalPrefixTransformRule'])) { |
|
| 929 | 31 | $this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']); |
|
| 930 | 31 | } |
|
| 931 | |||
| 932 | 1348 | foreach ($input['numberFormat'] as $numberFormatElt) { |
|
| 933 | 754 | $numberFormat = new NumberFormat(); |
|
| 934 | 754 | $numberFormat->fromArray($numberFormatElt); |
|
| 935 | 754 | $this->addNumberFormat($numberFormat); |
|
| 936 | 1348 | } |
|
| 937 | |||
| 938 | 1348 | foreach ($input['intlNumberFormat'] as $intlNumberFormatElt) { |
|
| 939 | 137 | $numberFormat = new NumberFormat(); |
|
| 940 | 137 | $numberFormat->fromArray($intlNumberFormatElt); |
|
| 941 | 137 | $this->addIntlNumberFormat($numberFormat); |
|
| 942 | 1348 | } |
|
| 943 | |||
| 944 | 1348 | $this->setMainCountryForCode($input['mainCountryForCode']); |
|
| 945 | |||
| 946 | 1348 | if (isset($input['leadingDigits'])) { |
|
| 947 | 79 | $this->setLeadingDigits($input['leadingDigits']); |
|
| 948 | 79 | } |
|
| 949 | |||
| 950 | 1348 | if (isset($input['leadingZeroPossible'])) { |
|
| 951 | 1348 | $this->setLeadingZeroPossible($input['leadingZeroPossible']); |
|
| 952 | 1348 | } |
|
| 953 | |||
| 954 | 1348 | if (isset($input['mobileNumberPortableRegion'])) { |
|
| 955 | 1348 | $this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']); |
|
| 956 | 1348 | } |
|
| 957 | |||
| 958 | 1348 | return $this; |
|
| 959 | } |
||
| 960 | |||
| 961 | 762 | public function addNumberFormat(NumberFormat $value) |
|
| 966 | |||
| 967 | 149 | public function addIntlNumberFormat(NumberFormat $value) |
|
| 972 | } |
||
| 973 |