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 | public function hasCountryCode() |
||
| 81 | { |
||
| 82 | return isset($this->countryCode); |
||
| 83 | } |
||
| 84 | |||
| 85 | public function hasInternationalPrefix() |
||
| 86 | { |
||
| 87 | 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 | public function getMainCountryForCode() |
||
| 101 | { |
||
| 102 | return $this->mainCountryForCode; |
||
| 103 | } |
||
| 104 | |||
| 105 | 867 | public function setMainCountryForCode($value) |
|
| 110 | |||
| 111 | public function hasLeadingZeroPossible() |
||
| 112 | { |
||
| 113 | return isset($this->leadingZeroPossible); |
||
| 114 | } |
||
| 115 | |||
| 116 | public function hasMobileNumberPortableRegion() |
||
| 117 | { |
||
| 118 | return isset($this->mobileNumberPortableRegion); |
||
| 119 | } |
||
| 120 | |||
| 121 | 1 | public function hasSameMobileAndFixedLinePattern() |
|
| 125 | |||
| 126 | 2 | public function numberFormatSize() |
|
| 127 | { |
||
| 128 | 2 | return count($this->numberFormat); |
|
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @param int $index |
||
| 133 | * @return NumberFormat |
||
| 134 | */ |
||
| 135 | 11 | public function getNumberFormat($index) |
|
| 139 | |||
| 140 | public function intlNumberFormatSize() |
||
| 141 | { |
||
| 142 | return count($this->intlNumberFormat); |
||
| 143 | } |
||
| 144 | |||
| 145 | 6 | public function getIntlNumberFormat($index) |
|
| 149 | |||
| 150 | 7 | public function clearIntlNumberFormat() |
|
| 155 | |||
| 156 | public function toArray() |
||
| 157 | { |
||
| 158 | $output = array(); |
||
| 159 | |||
| 160 | if ($this->hasGeneralDesc()) { |
||
| 161 | $output['generalDesc'] = $this->getGeneralDesc()->toArray(); |
||
| 162 | } |
||
| 163 | |||
| 164 | if ($this->hasFixedLine()) { |
||
| 165 | $output['fixedLine'] = $this->getFixedLine()->toArray(); |
||
| 166 | } |
||
| 167 | |||
| 168 | if ($this->hasMobile()) { |
||
| 169 | $output['mobile'] = $this->getMobile()->toArray(); |
||
| 170 | } |
||
| 171 | |||
| 172 | if ($this->hasTollFree()) { |
||
| 173 | $output['tollFree'] = $this->getTollFree()->toArray(); |
||
| 174 | } |
||
| 175 | |||
| 176 | if ($this->hasPremiumRate()) { |
||
| 177 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
||
| 178 | } |
||
| 179 | |||
| 180 | if ($this->hasPremiumRate()) { |
||
| 181 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
||
| 182 | } |
||
| 183 | |||
| 184 | if ($this->hasSharedCost()) { |
||
| 185 | $output['sharedCost'] = $this->getSharedCost()->toArray(); |
||
| 186 | } |
||
| 187 | |||
| 188 | if ($this->hasPersonalNumber()) { |
||
| 189 | $output['personalNumber'] = $this->getPersonalNumber()->toArray(); |
||
| 190 | } |
||
| 191 | |||
| 192 | if ($this->hasVoip()) { |
||
| 193 | $output['voip'] = $this->getVoip()->toArray(); |
||
| 194 | } |
||
| 195 | |||
| 196 | if ($this->hasPager()) { |
||
| 197 | $output['pager'] = $this->getPager()->toArray(); |
||
| 198 | } |
||
| 199 | |||
| 200 | if ($this->hasUan()) { |
||
| 201 | $output['uan'] = $this->getUan()->toArray(); |
||
| 202 | } |
||
| 203 | |||
| 204 | if ($this->hasEmergency()) { |
||
| 205 | $output['emergency'] = $this->getEmergency()->toArray(); |
||
| 206 | } |
||
| 207 | |||
| 208 | if ($this->hasVoicemail()) { |
||
| 209 | $output['voicemail'] = $this->getVoicemail()->toArray(); |
||
| 210 | } |
||
| 211 | |||
| 212 | if ($this->hasShortCode()) { |
||
| 213 | $output['shortCode'] = $this->getShortCode()->toArray(); |
||
| 214 | } |
||
| 215 | |||
| 216 | if ($this->hasStandardRate()) { |
||
| 217 | $output['standardRate'] = $this->getStandardRate()->toArray(); |
||
| 218 | } |
||
| 219 | |||
| 220 | if ($this->hasCarrierSpecific()) { |
||
| 221 | $output['carrierSpecific'] = $this->getCarrierSpecific()->toArray(); |
||
| 222 | } |
||
| 223 | |||
| 224 | if ($this->hasNoInternationalDialling()) { |
||
| 225 | $output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray(); |
||
| 226 | } |
||
| 227 | |||
| 228 | $output['id'] = $this->getId(); |
||
| 229 | if ($this->hasCountryCode()) { |
||
| 230 | $output['countryCode'] = $this->getCountryCode(); |
||
| 231 | } |
||
| 232 | |||
| 233 | if ($this->hasInternationalPrefix()) { |
||
| 234 | $output['internationalPrefix'] = $this->getInternationalPrefix(); |
||
| 235 | } |
||
| 236 | |||
| 237 | if ($this->hasPreferredInternationalPrefix()) { |
||
| 238 | $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix(); |
||
| 239 | } |
||
| 240 | |||
| 241 | if ($this->hasNationalPrefix()) { |
||
| 242 | $output['nationalPrefix'] = $this->getNationalPrefix(); |
||
| 243 | } |
||
| 244 | |||
| 245 | if ($this->hasPreferredExtnPrefix()) { |
||
| 246 | $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix(); |
||
| 247 | } |
||
| 248 | |||
| 249 | if ($this->hasNationalPrefixForParsing()) { |
||
| 250 | $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing(); |
||
| 251 | } |
||
| 252 | |||
| 253 | if ($this->hasNationalPrefixTransformRule()) { |
||
| 254 | $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule(); |
||
| 255 | } |
||
| 256 | |||
| 257 | if ($this->hasSameMobileAndFixedLinePattern()) { |
||
| 258 | $output['sameMobileAndFixedLinePattern'] = $this->isSameMobileAndFixedLinePattern(); |
||
| 259 | } |
||
| 260 | |||
| 261 | $output['numberFormat'] = array(); |
||
| 262 | foreach ($this->numberFormats() as $numberFormat) { |
||
| 263 | $output['numberFormat'][] = $numberFormat->toArray(); |
||
| 264 | } |
||
| 265 | |||
| 266 | $output['intlNumberFormat'] = array(); |
||
| 267 | foreach ($this->intlNumberFormats() as $intlNumberFormat) { |
||
| 268 | $output['intlNumberFormat'][] = $intlNumberFormat->toArray(); |
||
| 269 | } |
||
| 270 | |||
| 271 | $output['mainCountryForCode'] = $this->getMainCountryForCode(); |
||
| 272 | |||
| 273 | if ($this->hasLeadingDigits()) { |
||
| 274 | $output['leadingDigits'] = $this->getLeadingDigits(); |
||
| 275 | } |
||
| 276 | |||
| 277 | if ($this->hasLeadingZeroPossible()) { |
||
| 278 | $output['leadingZeroPossible'] = $this->isLeadingZeroPossible(); |
||
| 279 | } |
||
| 280 | |||
| 281 | if ($this->hasMobileNumberPortableRegion()) { |
||
| 282 | $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion(); |
||
| 283 | } |
||
| 284 | |||
| 285 | return $output; |
||
| 286 | } |
||
| 287 | |||
| 288 | public function hasGeneralDesc() |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @return PhoneNumberDesc |
||
| 295 | */ |
||
| 296 | 2780 | public function getGeneralDesc() |
|
| 300 | |||
| 301 | 872 | public function setGeneralDesc(PhoneNumberDesc $value) |
|
| 306 | |||
| 307 | public function hasFixedLine() |
||
| 311 | |||
| 312 | /** |
||
| 313 | * @return PhoneNumberDesc |
||
| 314 | */ |
||
| 315 | 1520 | public function getFixedLine() |
|
| 319 | |||
| 320 | 613 | public function setFixedLine(PhoneNumberDesc $value) |
|
| 325 | |||
| 326 | public function hasMobile() |
||
| 330 | |||
| 331 | /** |
||
| 332 | * @return PhoneNumberDesc |
||
| 333 | */ |
||
| 334 | 1128 | public function getMobile() |
|
| 338 | |||
| 339 | 613 | public function setMobile(PhoneNumberDesc $value) |
|
| 344 | |||
| 345 | public function hasTollFree() |
||
| 349 | |||
| 350 | /** |
||
| 351 | * @return PhoneNumberDesc |
||
| 352 | */ |
||
| 353 | 2149 | public function getTollFree() |
|
| 357 | |||
| 358 | 869 | public function setTollFree(PhoneNumberDesc $value) |
|
| 363 | |||
| 364 | public function hasPremiumRate() |
||
| 368 | |||
| 369 | /** |
||
| 370 | * @return PhoneNumberDesc |
||
| 371 | */ |
||
| 372 | 2377 | public function getPremiumRate() |
|
| 376 | |||
| 377 | 869 | public function setPremiumRate(PhoneNumberDesc $value) |
|
| 382 | |||
| 383 | public function hasSharedCost() |
||
| 387 | |||
| 388 | /** |
||
| 389 | * @return PhoneNumberDesc |
||
| 390 | */ |
||
| 391 | 1602 | public function getSharedCost() |
|
| 395 | |||
| 396 | 613 | public function setSharedCost(PhoneNumberDesc $value) |
|
| 401 | |||
| 402 | public function hasPersonalNumber() |
||
| 406 | |||
| 407 | /** |
||
| 408 | * @return PhoneNumberDesc |
||
| 409 | */ |
||
| 410 | 1458 | public function getPersonalNumber() |
|
| 414 | |||
| 415 | 613 | public function setPersonalNumber(PhoneNumberDesc $value) |
|
| 420 | |||
| 421 | public function hasVoip() |
||
| 425 | |||
| 426 | /** |
||
| 427 | * @return PhoneNumberDesc |
||
| 428 | */ |
||
| 429 | 1521 | public function getVoip() |
|
| 433 | |||
| 434 | 613 | public function setVoip(PhoneNumberDesc $value) |
|
| 439 | |||
| 440 | public function hasPager() |
||
| 444 | |||
| 445 | /** |
||
| 446 | * @return PhoneNumberDesc |
||
| 447 | */ |
||
| 448 | 1433 | public function getPager() |
|
| 452 | |||
| 453 | 613 | public function setPager(PhoneNumberDesc $value) |
|
| 458 | |||
| 459 | public function hasUan() |
||
| 463 | |||
| 464 | /** |
||
| 465 | * @return PhoneNumberDesc |
||
| 466 | */ |
||
| 467 | 1381 | public function getUan() |
|
| 471 | |||
| 472 | 613 | public function setUan(PhoneNumberDesc $value) |
|
| 477 | |||
| 478 | 274 | public function hasEmergency() |
|
| 482 | |||
| 483 | /** |
||
| 484 | * @return PhoneNumberDesc |
||
| 485 | */ |
||
| 486 | 275 | public function getEmergency() |
|
| 490 | |||
| 491 | 263 | public function setEmergency(PhoneNumberDesc $value) |
|
| 496 | |||
| 497 | public function hasVoicemail() |
||
| 501 | |||
| 502 | /** |
||
| 503 | * @return PhoneNumberDesc |
||
| 504 | */ |
||
| 505 | 1365 | public function getVoicemail() |
|
| 509 | |||
| 510 | 613 | public function setVoicemail(PhoneNumberDesc $value) |
|
| 515 | |||
| 516 | public function hasShortCode() |
||
| 520 | |||
| 521 | 251 | public function getShortCode() |
|
| 525 | |||
| 526 | 263 | public function setShortCode(PhoneNumberDesc $value) |
|
| 531 | |||
| 532 | public function hasStandardRate() |
||
| 536 | |||
| 537 | 528 | public function getStandardRate() |
|
| 541 | |||
| 542 | 263 | public function setStandardRate(PhoneNumberDesc $value) |
|
| 547 | |||
| 548 | public function hasCarrierSpecific() |
||
| 552 | |||
| 553 | 239 | public function getCarrierSpecific() |
|
| 557 | |||
| 558 | 263 | public function setCarrierSpecific(PhoneNumberDesc $value) |
|
| 563 | |||
| 564 | public function hasNoInternationalDialling() |
||
| 568 | |||
| 569 | 246 | public function getNoInternationalDialling() |
|
| 573 | |||
| 574 | 613 | public function setNoInternationalDialling(PhoneNumberDesc $value) |
|
| 579 | |||
| 580 | /** |
||
| 581 | * @return string |
||
| 582 | */ |
||
| 583 | 12 | public function getId() |
|
| 587 | |||
| 588 | /** |
||
| 589 | * @param string $value |
||
| 590 | * @return PhoneMetadata |
||
| 591 | */ |
||
| 592 | 873 | public function setId($value) |
|
| 597 | |||
| 598 | /** |
||
| 599 | * @return int |
||
| 600 | */ |
||
| 601 | 2734 | public function getCountryCode() |
|
| 605 | |||
| 606 | /** |
||
| 607 | * @param int $value |
||
| 608 | * @return PhoneMetadata |
||
| 609 | */ |
||
| 610 | 873 | public function setCountryCode($value) |
|
| 615 | |||
| 616 | 2727 | public function getInternationalPrefix() |
|
| 620 | |||
| 621 | 873 | public function setInternationalPrefix($value) |
|
| 626 | |||
| 627 | 3 | public function hasPreferredInternationalPrefix() |
|
| 631 | |||
| 632 | 5 | public function getPreferredInternationalPrefix() |
|
| 636 | |||
| 637 | 63 | public function setPreferredInternationalPrefix($value) |
|
| 642 | |||
| 643 | 2 | public function hasNationalPrefix() |
|
| 647 | |||
| 648 | 8 | public function getNationalPrefix() |
|
| 652 | |||
| 653 | 393 | public function setNationalPrefix($value) |
|
| 658 | |||
| 659 | 2 | public function hasPreferredExtnPrefix() |
|
| 663 | |||
| 664 | 2 | public function getPreferredExtnPrefix() |
|
| 668 | |||
| 669 | 85 | public function setPreferredExtnPrefix($value) |
|
| 674 | |||
| 675 | 3 | public function hasNationalPrefixForParsing() |
|
| 679 | |||
| 680 | 2739 | public function getNationalPrefixForParsing() |
|
| 684 | |||
| 685 | 404 | public function setNationalPrefixForParsing($value) |
|
| 690 | |||
| 691 | public function hasNationalPrefixTransformRule() |
||
| 695 | |||
| 696 | 73 | public function getNationalPrefixTransformRule() |
|
| 700 | |||
| 701 | 29 | public function setNationalPrefixTransformRule($value) |
|
| 706 | |||
| 707 | 1121 | public function isSameMobileAndFixedLinePattern() |
|
| 711 | |||
| 712 | 2 | public function setSameMobileAndFixedLinePattern($value) |
|
| 717 | |||
| 718 | /** |
||
| 719 | * @return NumberFormat[] |
||
| 720 | */ |
||
| 721 | 41 | public function numberFormats() |
|
| 725 | |||
| 726 | 44 | public function intlNumberFormats() |
|
| 730 | |||
| 731 | /** |
||
| 732 | * @return bool |
||
| 733 | */ |
||
| 734 | 521 | public function hasLeadingDigits() |
|
| 738 | |||
| 739 | 175 | public function getLeadingDigits() |
|
| 743 | |||
| 744 | 54 | public function setLeadingDigits($value) |
|
| 749 | |||
| 750 | 4 | public function isLeadingZeroPossible() |
|
| 754 | |||
| 755 | 867 | public function setLeadingZeroPossible($value) |
|
| 760 | |||
| 761 | 5 | public function isMobileNumberPortableRegion() |
|
| 765 | |||
| 766 | 867 | public function setMobileNumberPortableRegion($value) |
|
| 771 | |||
| 772 | /** |
||
| 773 | * @param array $input |
||
| 774 | * @return PhoneMetadata |
||
| 775 | */ |
||
| 776 | 866 | public function fromArray(array $input) |
|
| 777 | { |
||
| 778 | 866 | if (isset($input['generalDesc'])) { |
|
| 779 | 866 | $desc = new PhoneNumberDesc(); |
|
| 780 | 866 | $this->setGeneralDesc($desc->fromArray($input['generalDesc'])); |
|
| 781 | 866 | } |
|
| 782 | |||
| 783 | 866 | if (isset($input['fixedLine'])) { |
|
| 784 | 611 | $desc = new PhoneNumberDesc(); |
|
| 785 | 611 | $this->setFixedLine($desc->fromArray($input['fixedLine'])); |
|
| 786 | 611 | } |
|
| 787 | |||
| 788 | 866 | if (isset($input['mobile'])) { |
|
| 789 | 611 | $desc = new PhoneNumberDesc(); |
|
| 790 | 611 | $this->setMobile($desc->fromArray($input['mobile'])); |
|
| 791 | 611 | } |
|
| 792 | |||
| 793 | 866 | if (isset($input['tollFree'])) { |
|
| 794 | 866 | $desc = new PhoneNumberDesc(); |
|
| 795 | 866 | $this->setTollFree($desc->fromArray($input['tollFree'])); |
|
| 796 | 866 | } |
|
| 797 | |||
| 798 | 866 | if (isset($input['premiumRate'])) { |
|
| 799 | 866 | $desc = new PhoneNumberDesc(); |
|
| 800 | 866 | $this->setPremiumRate($desc->fromArray($input['premiumRate'])); |
|
| 801 | 866 | } |
|
| 802 | |||
| 803 | 866 | if (isset($input['sharedCost'])) { |
|
| 804 | 611 | $desc = new PhoneNumberDesc(); |
|
| 805 | 611 | $this->setSharedCost($desc->fromArray($input['sharedCost'])); |
|
| 806 | 611 | } |
|
| 807 | |||
| 808 | 866 | if (isset($input['personalNumber'])) { |
|
| 809 | 611 | $desc = new PhoneNumberDesc(); |
|
| 810 | 611 | $this->setPersonalNumber($desc->fromArray($input['personalNumber'])); |
|
| 811 | 611 | } |
|
| 812 | |||
| 813 | 866 | if (isset($input['voip'])) { |
|
| 814 | 611 | $desc = new PhoneNumberDesc(); |
|
| 815 | 611 | $this->setVoip($desc->fromArray($input['voip'])); |
|
| 816 | 611 | } |
|
| 817 | |||
| 818 | 866 | if (isset($input['pager'])) { |
|
| 819 | 611 | $desc = new PhoneNumberDesc(); |
|
| 820 | 611 | $this->setPager($desc->fromArray($input['pager'])); |
|
| 821 | 611 | } |
|
| 822 | |||
| 823 | 866 | if (isset($input['uan'])) { |
|
| 824 | 611 | $desc = new PhoneNumberDesc(); |
|
| 825 | 611 | $this->setUan($desc->fromArray($input['uan'])); |
|
| 826 | 611 | } |
|
| 827 | |||
| 828 | 866 | if (isset($input['emergency'])) { |
|
| 829 | 262 | $desc = new PhoneNumberDesc(); |
|
| 830 | 262 | $this->setEmergency($desc->fromArray($input['emergency'])); |
|
| 831 | 262 | } |
|
| 832 | |||
| 833 | 866 | if (isset($input['voicemail'])) { |
|
| 834 | 611 | $desc = new PhoneNumberDesc(); |
|
| 835 | 611 | $this->setVoicemail($desc->fromArray($input['voicemail'])); |
|
| 836 | 611 | } |
|
| 837 | |||
| 838 | 866 | if (isset($input['shortCode'])) { |
|
| 839 | 262 | $desc = new PhoneNumberDesc(); |
|
| 840 | 262 | $this->setShortCode(($desc->fromArray($input['shortCode']))); |
|
| 841 | 262 | } |
|
| 842 | |||
| 843 | 866 | if (isset($input['standardRate'])) { |
|
| 844 | 262 | $desc = new PhoneNumberDesc(); |
|
| 845 | 262 | $this->setStandardRate($desc->fromArray($input['standardRate'])); |
|
| 846 | 262 | } |
|
| 847 | |||
| 848 | 866 | if (isset($input['carrierSpecific'])) { |
|
| 849 | 262 | $desc = new PhoneNumberDesc(); |
|
| 850 | 262 | $this->setCarrierSpecific($desc->fromArray($input['carrierSpecific'])); |
|
| 851 | 262 | } |
|
| 852 | |||
| 853 | 866 | if (isset($input['noInternationalDialling'])) { |
|
| 854 | 611 | $desc = new PhoneNumberDesc(); |
|
| 855 | 611 | $this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling'])); |
|
| 856 | 611 | } |
|
| 857 | |||
| 858 | 866 | $this->setId($input['id']); |
|
| 859 | 866 | $this->setCountryCode($input['countryCode']); |
|
| 860 | 866 | $this->setInternationalPrefix($input['internationalPrefix']); |
|
| 861 | |||
| 862 | 866 | if (isset($input['preferredInternationalPrefix'])) { |
|
| 863 | 62 | $this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']); |
|
| 864 | 62 | } |
|
| 865 | 866 | if (isset($input['nationalPrefix'])) { |
|
| 866 | 390 | $this->setNationalPrefix($input['nationalPrefix']); |
|
| 867 | 390 | } |
|
| 868 | 866 | if (isset($input['nationalPrefix'])) { |
|
| 869 | 390 | $this->setNationalPrefix($input['nationalPrefix']); |
|
| 870 | 390 | } |
|
| 871 | |||
| 872 | 866 | if (isset($input['preferredExtnPrefix'])) { |
|
| 873 | 84 | $this->setPreferredExtnPrefix($input['preferredExtnPrefix']); |
|
| 874 | 84 | } |
|
| 875 | |||
| 876 | 866 | if (isset($input['nationalPrefixForParsing'])) { |
|
| 877 | 400 | $this->setNationalPrefixForParsing($input['nationalPrefixForParsing']); |
|
| 878 | 400 | } |
|
| 879 | |||
| 880 | 866 | if (isset($input['nationalPrefixTransformRule'])) { |
|
| 881 | 27 | $this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']); |
|
| 882 | 27 | } |
|
| 883 | |||
| 884 | 866 | foreach ($input['numberFormat'] as $numberFormatElt) { |
|
| 885 | 556 | $numberFormat = new NumberFormat(); |
|
| 886 | 556 | $numberFormat->fromArray($numberFormatElt); |
|
| 887 | 556 | $this->addNumberFormat($numberFormat); |
|
| 888 | 866 | } |
|
| 889 | |||
| 890 | 866 | foreach ($input['intlNumberFormat'] as $intlNumberFormatElt) { |
|
| 891 | 122 | $numberFormat = new NumberFormat(); |
|
| 892 | 122 | $numberFormat->fromArray($intlNumberFormatElt); |
|
| 893 | 122 | $this->addIntlNumberFormat($numberFormat); |
|
| 894 | 866 | } |
|
| 895 | |||
| 896 | 866 | $this->setMainCountryForCode($input['mainCountryForCode']); |
|
| 897 | |||
| 898 | 866 | if (isset($input['leadingDigits'])) { |
|
| 899 | 53 | $this->setLeadingDigits($input['leadingDigits']); |
|
| 900 | 53 | } |
|
| 901 | |||
| 902 | 866 | if (isset($input['leadingZeroPossible'])) { |
|
| 903 | 866 | $this->setLeadingZeroPossible($input['leadingZeroPossible']); |
|
| 904 | 866 | } |
|
| 905 | |||
| 906 | 866 | if (isset($input['mobileNumberPortableRegion'])) { |
|
| 907 | 866 | $this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']); |
|
| 908 | 866 | } |
|
| 909 | |||
| 910 | 866 | return $this; |
|
| 911 | } |
||
| 912 | |||
| 913 | 564 | public function addNumberFormat(NumberFormat $value) |
|
| 918 | |||
| 919 | 134 | public function addIntlNumberFormat(NumberFormat $value) |
|
| 924 | } |
||
| 925 |