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 | $output['countryCode'] = $this->getCountryCode(); |
||
| 230 | $output['internationalPrefix'] = $this->getInternationalPrefix(); |
||
| 231 | |||
| 232 | if ($this->hasPreferredInternationalPrefix()) { |
||
| 233 | $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix(); |
||
| 234 | } |
||
| 235 | |||
| 236 | if ($this->hasNationalPrefix()) { |
||
| 237 | $output['nationalPrefix'] = $this->getNationalPrefix(); |
||
| 238 | } |
||
| 239 | |||
| 240 | if ($this->hasPreferredExtnPrefix()) { |
||
| 241 | $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix(); |
||
| 242 | } |
||
| 243 | |||
| 244 | if ($this->hasNationalPrefixForParsing()) { |
||
| 245 | $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing(); |
||
| 246 | } |
||
| 247 | |||
| 248 | if ($this->hasNationalPrefixTransformRule()) { |
||
| 249 | $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule(); |
||
| 250 | } |
||
| 251 | |||
| 252 | $output['sameMobileAndFixedLinePattern'] = $this->isSameMobileAndFixedLinePattern(); |
||
| 253 | |||
| 254 | $output['numberFormat'] = array(); |
||
| 255 | foreach ($this->numberFormats() as $numberFormat) { |
||
| 256 | $output['numberFormat'][] = $numberFormat->toArray(); |
||
| 257 | } |
||
| 258 | |||
| 259 | $output['intlNumberFormat'] = array(); |
||
| 260 | foreach ($this->intlNumberFormats() as $intlNumberFormat) { |
||
| 261 | $output['intlNumberFormat'][] = $intlNumberFormat->toArray(); |
||
| 262 | } |
||
| 263 | |||
| 264 | $output['mainCountryForCode'] = $this->getMainCountryForCode(); |
||
| 265 | |||
| 266 | if ($this->hasLeadingDigits()) { |
||
| 267 | $output['leadingDigits'] = $this->getLeadingDigits(); |
||
| 268 | } |
||
| 269 | |||
| 270 | $output['leadingZeroPossible'] = $this->isLeadingZeroPossible(); |
||
| 271 | |||
| 272 | $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion(); |
||
| 273 | |||
| 274 | return $output; |
||
| 275 | } |
||
| 276 | |||
| 277 | public function hasGeneralDesc() |
||
| 278 | { |
||
| 279 | return isset($this->generalDesc); |
||
| 280 | } |
||
| 281 | |||
| 282 | /** |
||
| 283 | * @return PhoneNumberDesc |
||
| 284 | */ |
||
| 285 | 2780 | public function getGeneralDesc() |
|
| 289 | |||
| 290 | 872 | public function setGeneralDesc(PhoneNumberDesc $value) |
|
| 291 | { |
||
| 292 | 872 | $this->generalDesc = $value; |
|
| 293 | 872 | return $this; |
|
| 294 | } |
||
| 295 | |||
| 296 | public function hasFixedLine() |
||
| 297 | { |
||
| 298 | return isset($this->fixedLine); |
||
| 299 | } |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @return PhoneNumberDesc |
||
| 303 | */ |
||
| 304 | 1520 | public function getFixedLine() |
|
| 308 | |||
| 309 | 613 | public function setFixedLine(PhoneNumberDesc $value) |
|
| 310 | { |
||
| 311 | 613 | $this->fixedLine = $value; |
|
| 312 | 613 | return $this; |
|
| 313 | } |
||
| 314 | |||
| 315 | public function hasMobile() |
||
| 316 | { |
||
| 317 | return isset($this->mobile); |
||
| 318 | } |
||
| 319 | |||
| 320 | /** |
||
| 321 | * @return PhoneNumberDesc |
||
| 322 | */ |
||
| 323 | 1128 | public function getMobile() |
|
| 327 | |||
| 328 | 613 | public function setMobile(PhoneNumberDesc $value) |
|
| 329 | { |
||
| 330 | 613 | $this->mobile = $value; |
|
| 331 | 613 | return $this; |
|
| 332 | } |
||
| 333 | |||
| 334 | public function hasTollFree() |
||
| 335 | { |
||
| 336 | return isset($this->tollFree); |
||
| 337 | } |
||
| 338 | |||
| 339 | /** |
||
| 340 | * @return PhoneNumberDesc |
||
| 341 | */ |
||
| 342 | 2149 | public function getTollFree() |
|
| 346 | |||
| 347 | 869 | public function setTollFree(PhoneNumberDesc $value) |
|
| 348 | { |
||
| 349 | 869 | $this->tollFree = $value; |
|
| 350 | 869 | return $this; |
|
| 351 | } |
||
| 352 | |||
| 353 | public function hasPremiumRate() |
||
| 354 | { |
||
| 355 | return isset($this->premiumRate); |
||
| 356 | } |
||
| 357 | |||
| 358 | /** |
||
| 359 | * @return PhoneNumberDesc |
||
| 360 | */ |
||
| 361 | 2377 | public function getPremiumRate() |
|
| 365 | |||
| 366 | 869 | public function setPremiumRate(PhoneNumberDesc $value) |
|
| 367 | { |
||
| 368 | 869 | $this->premiumRate = $value; |
|
| 369 | 869 | return $this; |
|
| 370 | } |
||
| 371 | |||
| 372 | public function hasSharedCost() |
||
| 373 | { |
||
| 374 | return isset($this->sharedCost); |
||
| 375 | } |
||
| 376 | |||
| 377 | /** |
||
| 378 | * @return PhoneNumberDesc |
||
| 379 | */ |
||
| 380 | 1602 | public function getSharedCost() |
|
| 384 | |||
| 385 | 613 | public function setSharedCost(PhoneNumberDesc $value) |
|
| 386 | { |
||
| 387 | 613 | $this->sharedCost = $value; |
|
| 388 | 613 | return $this; |
|
| 389 | } |
||
| 390 | |||
| 391 | public function hasPersonalNumber() |
||
| 392 | { |
||
| 393 | return isset($this->personalNumber); |
||
| 394 | } |
||
| 395 | |||
| 396 | /** |
||
| 397 | * @return PhoneNumberDesc |
||
| 398 | */ |
||
| 399 | 1458 | public function getPersonalNumber() |
|
| 403 | |||
| 404 | 613 | public function setPersonalNumber(PhoneNumberDesc $value) |
|
| 405 | { |
||
| 406 | 613 | $this->personalNumber = $value; |
|
| 407 | 613 | return $this; |
|
| 408 | } |
||
| 409 | |||
| 410 | public function hasVoip() |
||
| 411 | { |
||
| 412 | return isset($this->voip); |
||
| 413 | } |
||
| 414 | |||
| 415 | /** |
||
| 416 | * @return PhoneNumberDesc |
||
| 417 | */ |
||
| 418 | 1521 | public function getVoip() |
|
| 422 | |||
| 423 | 613 | public function setVoip(PhoneNumberDesc $value) |
|
| 424 | { |
||
| 425 | 613 | $this->voip = $value; |
|
| 426 | 613 | return $this; |
|
| 427 | } |
||
| 428 | |||
| 429 | public function hasPager() |
||
| 430 | { |
||
| 431 | return isset($this->pager); |
||
| 432 | } |
||
| 433 | |||
| 434 | /** |
||
| 435 | * @return PhoneNumberDesc |
||
| 436 | */ |
||
| 437 | 1433 | public function getPager() |
|
| 441 | |||
| 442 | 613 | public function setPager(PhoneNumberDesc $value) |
|
| 443 | { |
||
| 444 | 613 | $this->pager = $value; |
|
| 445 | 613 | return $this; |
|
| 446 | } |
||
| 447 | |||
| 448 | public function hasUan() |
||
| 449 | { |
||
| 450 | return isset($this->uan); |
||
| 451 | } |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return PhoneNumberDesc |
||
| 455 | */ |
||
| 456 | 1381 | public function getUan() |
|
| 460 | |||
| 461 | 613 | public function setUan(PhoneNumberDesc $value) |
|
| 462 | { |
||
| 463 | 613 | $this->uan = $value; |
|
| 464 | 613 | return $this; |
|
| 465 | } |
||
| 466 | |||
| 467 | 274 | public function hasEmergency() |
|
| 471 | |||
| 472 | /** |
||
| 473 | * @return PhoneNumberDesc |
||
| 474 | */ |
||
| 475 | 275 | public function getEmergency() |
|
| 479 | |||
| 480 | 263 | public function setEmergency(PhoneNumberDesc $value) |
|
| 481 | { |
||
| 482 | 263 | $this->emergency = $value; |
|
| 483 | 263 | return $this; |
|
| 484 | } |
||
| 485 | |||
| 486 | public function hasVoicemail() |
||
| 487 | { |
||
| 488 | return isset($this->voicemail); |
||
| 489 | } |
||
| 490 | |||
| 491 | /** |
||
| 492 | * @return PhoneNumberDesc |
||
| 493 | */ |
||
| 494 | 1365 | public function getVoicemail() |
|
| 498 | |||
| 499 | 613 | public function setVoicemail(PhoneNumberDesc $value) |
|
| 500 | { |
||
| 501 | 613 | $this->voicemail = $value; |
|
| 502 | 613 | return $this; |
|
| 503 | } |
||
| 504 | |||
| 505 | public function hasShortCode() |
||
| 506 | { |
||
| 507 | return isset($this->short_code); |
||
| 508 | } |
||
| 509 | |||
| 510 | 251 | public function getShortCode() |
|
| 514 | |||
| 515 | 263 | public function setShortCode(PhoneNumberDesc $value) |
|
| 516 | { |
||
| 517 | 263 | $this->short_code = $value; |
|
| 518 | 263 | return $this; |
|
| 519 | } |
||
| 520 | |||
| 521 | public function hasStandardRate() |
||
| 522 | { |
||
| 523 | return isset($this->standard_rate); |
||
| 524 | } |
||
| 525 | |||
| 526 | 528 | public function getStandardRate() |
|
| 530 | |||
| 531 | 263 | public function setStandardRate(PhoneNumberDesc $value) |
|
| 532 | { |
||
| 533 | 263 | $this->standard_rate = $value; |
|
| 534 | 263 | return $this; |
|
| 535 | } |
||
| 536 | |||
| 537 | public function hasCarrierSpecific() |
||
| 538 | { |
||
| 539 | return isset($this->carrierSpecific); |
||
| 540 | } |
||
| 541 | |||
| 542 | 239 | public function getCarrierSpecific() |
|
| 546 | |||
| 547 | 263 | public function setCarrierSpecific(PhoneNumberDesc $value) |
|
| 548 | { |
||
| 549 | 263 | $this->carrierSpecific = $value; |
|
| 550 | 263 | return $this; |
|
| 551 | } |
||
| 552 | |||
| 553 | public function hasNoInternationalDialling() |
||
| 554 | { |
||
| 555 | return isset($this->noInternationalDialling); |
||
| 556 | } |
||
| 557 | |||
| 558 | 246 | public function getNoInternationalDialling() |
|
| 562 | |||
| 563 | 613 | public function setNoInternationalDialling(PhoneNumberDesc $value) |
|
| 564 | { |
||
| 565 | 613 | $this->noInternationalDialling = $value; |
|
| 566 | 613 | return $this; |
|
| 567 | } |
||
| 568 | |||
| 569 | /** |
||
| 570 | * @return string |
||
| 571 | */ |
||
| 572 | 12 | public function getId() |
|
| 576 | |||
| 577 | /** |
||
| 578 | * @param string $value |
||
| 579 | * @return PhoneMetadata |
||
| 580 | */ |
||
| 581 | 873 | public function setId($value) |
|
| 586 | |||
| 587 | /** |
||
| 588 | * @return int |
||
| 589 | */ |
||
| 590 | 2734 | public function getCountryCode() |
|
| 594 | |||
| 595 | /** |
||
| 596 | * @param int $value |
||
| 597 | * @return PhoneMetadata |
||
| 598 | */ |
||
| 599 | 873 | public function setCountryCode($value) |
|
| 604 | |||
| 605 | 2727 | public function getInternationalPrefix() |
|
| 609 | |||
| 610 | 873 | public function setInternationalPrefix($value) |
|
| 615 | |||
| 616 | 3 | public function hasPreferredInternationalPrefix() |
|
| 620 | |||
| 621 | 5 | public function getPreferredInternationalPrefix() |
|
| 625 | |||
| 626 | 63 | public function setPreferredInternationalPrefix($value) |
|
| 631 | |||
| 632 | 2 | public function hasNationalPrefix() |
|
| 636 | |||
| 637 | 8 | public function getNationalPrefix() |
|
| 641 | |||
| 642 | 393 | public function setNationalPrefix($value) |
|
| 647 | |||
| 648 | 2 | public function hasPreferredExtnPrefix() |
|
| 649 | { |
||
| 650 | 2 | return isset($this->preferredExtnPrefix); |
|
| 651 | } |
||
| 652 | |||
| 653 | 2 | public function getPreferredExtnPrefix() |
|
| 657 | |||
| 658 | 85 | public function setPreferredExtnPrefix($value) |
|
| 663 | |||
| 664 | 3 | public function hasNationalPrefixForParsing() |
|
| 668 | |||
| 669 | 2739 | public function getNationalPrefixForParsing() |
|
| 673 | |||
| 674 | 404 | public function setNationalPrefixForParsing($value) |
|
| 679 | |||
| 680 | public function hasNationalPrefixTransformRule() |
||
| 681 | { |
||
| 682 | return isset($this->nationalPrefixTransformRule); |
||
| 683 | } |
||
| 684 | |||
| 685 | 73 | public function getNationalPrefixTransformRule() |
|
| 689 | |||
| 690 | 29 | public function setNationalPrefixTransformRule($value) |
|
| 695 | |||
| 696 | 1121 | public function isSameMobileAndFixedLinePattern() |
|
| 700 | |||
| 701 | 2 | public function setSameMobileAndFixedLinePattern($value) |
|
| 706 | |||
| 707 | /** |
||
| 708 | * @return NumberFormat[] |
||
| 709 | */ |
||
| 710 | 41 | public function numberFormats() |
|
| 714 | |||
| 715 | 44 | public function intlNumberFormats() |
|
| 719 | |||
| 720 | /** |
||
| 721 | * @return bool |
||
| 722 | */ |
||
| 723 | 521 | public function hasLeadingDigits() |
|
| 727 | |||
| 728 | 175 | public function getLeadingDigits() |
|
| 732 | |||
| 733 | 54 | public function setLeadingDigits($value) |
|
| 738 | |||
| 739 | 4 | public function isLeadingZeroPossible() |
|
| 743 | |||
| 744 | 867 | public function setLeadingZeroPossible($value) |
|
| 749 | |||
| 750 | 5 | public function isMobileNumberPortableRegion() |
|
| 754 | |||
| 755 | 867 | public function setMobileNumberPortableRegion($value) |
|
| 760 | |||
| 761 | /** |
||
| 762 | * @param array $input |
||
| 763 | * @return PhoneMetadata |
||
| 764 | */ |
||
| 765 | 866 | public function fromArray(array $input) |
|
| 766 | { |
||
| 767 | 866 | if (isset($input['generalDesc'])) { |
|
| 768 | 866 | $desc = new PhoneNumberDesc(); |
|
| 769 | 866 | $this->setGeneralDesc($desc->fromArray($input['generalDesc'])); |
|
| 770 | } |
||
| 771 | |||
| 772 | 866 | if (isset($input['fixedLine'])) { |
|
| 773 | 611 | $desc = new PhoneNumberDesc(); |
|
| 774 | 611 | $this->setFixedLine($desc->fromArray($input['fixedLine'])); |
|
| 775 | } |
||
| 776 | |||
| 777 | 866 | if (isset($input['mobile'])) { |
|
| 778 | 611 | $desc = new PhoneNumberDesc(); |
|
| 779 | 611 | $this->setMobile($desc->fromArray($input['mobile'])); |
|
| 780 | } |
||
| 781 | |||
| 782 | 866 | if (isset($input['tollFree'])) { |
|
| 783 | 866 | $desc = new PhoneNumberDesc(); |
|
| 784 | 866 | $this->setTollFree($desc->fromArray($input['tollFree'])); |
|
| 785 | } |
||
| 786 | |||
| 787 | 866 | if (isset($input['premiumRate'])) { |
|
| 788 | 866 | $desc = new PhoneNumberDesc(); |
|
| 789 | 866 | $this->setPremiumRate($desc->fromArray($input['premiumRate'])); |
|
| 790 | } |
||
| 791 | |||
| 792 | 866 | if (isset($input['sharedCost'])) { |
|
| 793 | 611 | $desc = new PhoneNumberDesc(); |
|
| 794 | 611 | $this->setSharedCost($desc->fromArray($input['sharedCost'])); |
|
| 795 | } |
||
| 796 | |||
| 797 | 866 | if (isset($input['personalNumber'])) { |
|
| 798 | 611 | $desc = new PhoneNumberDesc(); |
|
| 799 | 611 | $this->setPersonalNumber($desc->fromArray($input['personalNumber'])); |
|
| 800 | } |
||
| 801 | |||
| 802 | 866 | if (isset($input['voip'])) { |
|
| 803 | 611 | $desc = new PhoneNumberDesc(); |
|
| 804 | 611 | $this->setVoip($desc->fromArray($input['voip'])); |
|
| 805 | } |
||
| 806 | |||
| 807 | 866 | if (isset($input['pager'])) { |
|
| 808 | 611 | $desc = new PhoneNumberDesc(); |
|
| 809 | 611 | $this->setPager($desc->fromArray($input['pager'])); |
|
| 810 | } |
||
| 811 | |||
| 812 | 866 | if (isset($input['uan'])) { |
|
| 813 | 611 | $desc = new PhoneNumberDesc(); |
|
| 814 | 611 | $this->setUan($desc->fromArray($input['uan'])); |
|
| 815 | } |
||
| 816 | |||
| 817 | 866 | if (isset($input['emergency'])) { |
|
| 818 | 262 | $desc = new PhoneNumberDesc(); |
|
| 819 | 262 | $this->setEmergency($desc->fromArray($input['emergency'])); |
|
| 820 | } |
||
| 821 | |||
| 822 | 866 | if (isset($input['voicemail'])) { |
|
| 823 | 611 | $desc = new PhoneNumberDesc(); |
|
| 824 | 611 | $this->setVoicemail($desc->fromArray($input['voicemail'])); |
|
| 825 | } |
||
| 826 | |||
| 827 | 866 | if (isset($input['shortCode'])) { |
|
| 828 | 262 | $desc = new PhoneNumberDesc(); |
|
| 829 | 262 | $this->setShortCode(($desc->fromArray($input['shortCode']))); |
|
| 830 | } |
||
| 831 | |||
| 832 | 866 | if (isset($input['standardRate'])) { |
|
| 833 | 262 | $desc = new PhoneNumberDesc(); |
|
| 834 | 262 | $this->setStandardRate($desc->fromArray($input['standardRate'])); |
|
| 835 | } |
||
| 836 | |||
| 837 | 866 | if (isset($input['carrierSpecific'])) { |
|
| 838 | 262 | $desc = new PhoneNumberDesc(); |
|
| 839 | 262 | $this->setCarrierSpecific($desc->fromArray($input['carrierSpecific'])); |
|
| 840 | } |
||
| 841 | |||
| 842 | 866 | if (isset($input['noInternationalDialling'])) { |
|
| 843 | 611 | $desc = new PhoneNumberDesc(); |
|
| 844 | 611 | $this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling'])); |
|
| 845 | } |
||
| 846 | |||
| 847 | 866 | $this->setId($input['id']); |
|
| 848 | 866 | $this->setCountryCode($input['countryCode']); |
|
| 849 | 866 | $this->setInternationalPrefix($input['internationalPrefix']); |
|
| 850 | |||
| 851 | 866 | if (isset($input['preferredInternationalPrefix'])) { |
|
| 852 | 62 | $this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']); |
|
| 853 | } |
||
| 854 | 866 | if (isset($input['nationalPrefix'])) { |
|
| 855 | 390 | $this->setNationalPrefix($input['nationalPrefix']); |
|
| 856 | } |
||
| 857 | 866 | if (isset($input['nationalPrefix'])) { |
|
| 858 | 390 | $this->setNationalPrefix($input['nationalPrefix']); |
|
| 859 | } |
||
| 860 | |||
| 861 | 866 | if (isset($input['preferredExtnPrefix'])) { |
|
| 862 | 84 | $this->setPreferredExtnPrefix($input['preferredExtnPrefix']); |
|
| 863 | } |
||
| 864 | |||
| 865 | 866 | if (isset($input['nationalPrefixForParsing'])) { |
|
| 866 | 400 | $this->setNationalPrefixForParsing($input['nationalPrefixForParsing']); |
|
| 867 | } |
||
| 868 | |||
| 869 | 866 | if (isset($input['nationalPrefixTransformRule'])) { |
|
| 870 | 27 | $this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']); |
|
| 871 | } |
||
| 872 | |||
| 873 | 866 | foreach ($input['numberFormat'] as $numberFormatElt) { |
|
| 874 | 556 | $numberFormat = new NumberFormat(); |
|
| 875 | 556 | $numberFormat->fromArray($numberFormatElt); |
|
| 876 | 556 | $this->addNumberFormat($numberFormat); |
|
| 877 | } |
||
| 878 | |||
| 879 | 866 | foreach ($input['intlNumberFormat'] as $intlNumberFormatElt) { |
|
| 880 | 122 | $numberFormat = new NumberFormat(); |
|
| 881 | 122 | $numberFormat->fromArray($intlNumberFormatElt); |
|
| 882 | 122 | $this->addIntlNumberFormat($numberFormat); |
|
| 883 | } |
||
| 884 | |||
| 885 | 866 | $this->setMainCountryForCode($input['mainCountryForCode']); |
|
| 886 | |||
| 887 | 866 | if (isset($input['leadingDigits'])) { |
|
| 888 | 53 | $this->setLeadingDigits($input['leadingDigits']); |
|
| 889 | } |
||
| 890 | |||
| 891 | 866 | $this->setLeadingZeroPossible($input['leadingZeroPossible']); |
|
| 892 | |||
| 893 | 866 | $this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']); |
|
| 894 | |||
| 895 | 866 | return $this; |
|
| 896 | } |
||
| 897 | |||
| 898 | 564 | public function addNumberFormat(NumberFormat $value) |
|
| 903 | |||
| 904 | 134 | public function addIntlNumberFormat(NumberFormat $value) |
|
| 909 | } |
||
| 910 |