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 | 482 | public function hasLeadingZeroPossible() |
|
112 | { |
||
113 | 482 | return isset($this->leadingZeroPossible); |
|
114 | } |
||
115 | |||
116 | 482 | public function hasMobileNumberPortableRegion() |
|
117 | { |
||
118 | 482 | return isset($this->mobileNumberPortableRegion); |
|
119 | } |
||
120 | |||
121 | 483 | 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 | 482 | public function toArray() |
|
157 | { |
||
158 | 482 | $output = array(); |
|
159 | |||
160 | 482 | if ($this->hasGeneralDesc()) { |
|
161 | 482 | $output['generalDesc'] = $this->getGeneralDesc()->toArray(); |
|
162 | 482 | } |
|
163 | |||
164 | 482 | if ($this->hasFixedLine()) { |
|
165 | 244 | $output['fixedLine'] = $this->getFixedLine()->toArray(); |
|
166 | 244 | } |
|
167 | |||
168 | 482 | if ($this->hasMobile()) { |
|
169 | 244 | $output['mobile'] = $this->getMobile()->toArray(); |
|
170 | 244 | } |
|
171 | |||
172 | 482 | if ($this->hasTollFree()) { |
|
173 | 482 | $output['tollFree'] = $this->getTollFree()->toArray(); |
|
174 | 482 | } |
|
175 | |||
176 | 482 | if ($this->hasPremiumRate()) { |
|
177 | 482 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
|
178 | 482 | } |
|
179 | |||
180 | 482 | if ($this->hasPremiumRate()) { |
|
181 | 482 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
|
182 | 482 | } |
|
183 | |||
184 | 482 | if ($this->hasSharedCost()) { |
|
185 | 244 | $output['sharedCost'] = $this->getSharedCost()->toArray(); |
|
186 | 244 | } |
|
187 | |||
188 | 482 | if ($this->hasPersonalNumber()) { |
|
189 | 244 | $output['personalNumber'] = $this->getPersonalNumber()->toArray(); |
|
190 | 244 | } |
|
191 | |||
192 | 482 | if ($this->hasVoip()) { |
|
193 | 244 | $output['voip'] = $this->getVoip()->toArray(); |
|
194 | 244 | } |
|
195 | |||
196 | 482 | if ($this->hasPager()) { |
|
197 | 244 | $output['pager'] = $this->getPager()->toArray(); |
|
198 | 244 | } |
|
199 | |||
200 | 482 | if ($this->hasUan()) { |
|
201 | 244 | $output['uan'] = $this->getUan()->toArray(); |
|
202 | 244 | } |
|
203 | |||
204 | 482 | if ($this->hasEmergency()) { |
|
205 | 238 | $output['emergency'] = $this->getEmergency()->toArray(); |
|
206 | 238 | } |
|
207 | |||
208 | 482 | if ($this->hasVoicemail()) { |
|
209 | 244 | $output['voicemail'] = $this->getVoicemail()->toArray(); |
|
210 | 244 | } |
|
211 | |||
212 | 482 | if ($this->hasShortCode()) { |
|
213 | 238 | $output['shortCode'] = $this->getShortCode()->toArray(); |
|
214 | 238 | } |
|
215 | |||
216 | 482 | if ($this->hasStandardRate()) { |
|
217 | 238 | $output['standardRate'] = $this->getStandardRate()->toArray(); |
|
218 | 238 | } |
|
219 | |||
220 | 482 | if ($this->hasCarrierSpecific()) { |
|
221 | 238 | $output['carrierSpecific'] = $this->getCarrierSpecific()->toArray(); |
|
222 | 238 | } |
|
223 | |||
224 | 482 | if ($this->hasNoInternationalDialling()) { |
|
225 | 244 | $output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray(); |
|
226 | 244 | } |
|
227 | |||
228 | 482 | $output['id'] = $this->getId(); |
|
229 | 482 | if ($this->hasCountryCode()) { |
|
230 | 482 | $output['countryCode'] = $this->getCountryCode(); |
|
231 | 482 | } |
|
232 | |||
233 | 482 | if ($this->hasInternationalPrefix()) { |
|
234 | 482 | $output['internationalPrefix'] = $this->getInternationalPrefix(); |
|
235 | 482 | } |
|
236 | |||
237 | 482 | if ($this->hasPreferredInternationalPrefix()) { |
|
238 | 22 | $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix(); |
|
239 | 22 | } |
|
240 | |||
241 | 482 | if ($this->hasNationalPrefix()) { |
|
242 | 146 | $output['nationalPrefix'] = $this->getNationalPrefix(); |
|
243 | 146 | } |
|
244 | |||
245 | 482 | if ($this->hasPreferredExtnPrefix()) { |
|
246 | 8 | $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix(); |
|
247 | 8 | } |
|
248 | |||
249 | 482 | if ($this->hasNationalPrefixForParsing()) { |
|
250 | 151 | $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing(); |
|
251 | 151 | } |
|
252 | |||
253 | 482 | if ($this->hasNationalPrefixTransformRule()) { |
|
254 | 4 | $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule(); |
|
255 | 4 | } |
|
256 | |||
257 | 482 | if ($this->hasSameMobileAndFixedLinePattern()) { |
|
258 | 482 | $output['sameMobileAndFixedLinePattern'] = $this->isSameMobileAndFixedLinePattern(); |
|
259 | 482 | } |
|
260 | |||
261 | 482 | $output['numberFormat'] = array(); |
|
262 | 482 | foreach ($this->numberFormats() as $numberFormat) { |
|
263 | 198 | $output['numberFormat'][] = $numberFormat->toArray(); |
|
264 | 482 | } |
|
265 | |||
266 | 482 | $output['intlNumberFormat'] = array(); |
|
267 | 482 | foreach ($this->intlNumberFormats() as $intlNumberFormat) { |
|
268 | 15 | $output['intlNumberFormat'][] = $intlNumberFormat->toArray(); |
|
269 | 482 | } |
|
270 | |||
271 | 482 | $output['mainCountryForCode'] = $this->getMainCountryForCode(); |
|
272 | |||
273 | 482 | if ($this->hasLeadingDigits()) { |
|
274 | 26 | $output['leadingDigits'] = $this->getLeadingDigits(); |
|
275 | 26 | } |
|
276 | |||
277 | 482 | if ($this->hasLeadingZeroPossible()) { |
|
278 | 482 | $output['leadingZeroPossible'] = $this->isLeadingZeroPossible(); |
|
279 | 482 | } |
|
280 | |||
281 | 482 | if ($this->hasMobileNumberPortableRegion()) { |
|
282 | 482 | $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion(); |
|
283 | 482 | } |
|
284 | |||
285 | 482 | return $output; |
|
286 | } |
||
287 | |||
288 | 482 | public function hasGeneralDesc() |
|
289 | { |
||
290 | 482 | return isset($this->generalDesc); |
|
291 | } |
||
292 | |||
293 | /** |
||
294 | * @return PhoneNumberDesc |
||
295 | */ |
||
296 | 3262 | public function getGeneralDesc() |
|
300 | |||
301 | 1354 | public function setGeneralDesc(PhoneNumberDesc $value) |
|
306 | |||
307 | 482 | public function hasFixedLine() |
|
308 | { |
||
309 | 482 | return isset($this->fixedLine); |
|
310 | } |
||
311 | |||
312 | /** |
||
313 | * @return PhoneNumberDesc |
||
314 | */ |
||
315 | 1764 | public function getFixedLine() |
|
319 | |||
320 | 857 | public function setFixedLine(PhoneNumberDesc $value) |
|
325 | |||
326 | 482 | public function hasMobile() |
|
327 | { |
||
328 | 482 | return isset($this->mobile); |
|
329 | } |
||
330 | |||
331 | /** |
||
332 | * @return PhoneNumberDesc |
||
333 | */ |
||
334 | 1372 | public function getMobile() |
|
338 | |||
339 | 857 | public function setMobile(PhoneNumberDesc $value) |
|
344 | |||
345 | 482 | public function hasTollFree() |
|
346 | { |
||
347 | 482 | return isset($this->tollFree); |
|
348 | } |
||
349 | |||
350 | /** |
||
351 | * @return PhoneNumberDesc |
||
352 | */ |
||
353 | 2631 | public function getTollFree() |
|
357 | |||
358 | 1351 | public function setTollFree(PhoneNumberDesc $value) |
|
363 | |||
364 | 482 | public function hasPremiumRate() |
|
365 | { |
||
366 | 482 | return isset($this->premiumRate); |
|
367 | } |
||
368 | |||
369 | /** |
||
370 | * @return PhoneNumberDesc |
||
371 | */ |
||
372 | 2859 | public function getPremiumRate() |
|
376 | |||
377 | 1351 | public function setPremiumRate(PhoneNumberDesc $value) |
|
382 | |||
383 | 482 | public function hasSharedCost() |
|
384 | { |
||
385 | 482 | return isset($this->sharedCost); |
|
386 | } |
||
387 | |||
388 | /** |
||
389 | * @return PhoneNumberDesc |
||
390 | */ |
||
391 | 1846 | public function getSharedCost() |
|
395 | |||
396 | 857 | public function setSharedCost(PhoneNumberDesc $value) |
|
401 | |||
402 | 482 | public function hasPersonalNumber() |
|
403 | { |
||
404 | 482 | return isset($this->personalNumber); |
|
405 | } |
||
406 | |||
407 | /** |
||
408 | * @return PhoneNumberDesc |
||
409 | */ |
||
410 | 1702 | public function getPersonalNumber() |
|
414 | |||
415 | 857 | public function setPersonalNumber(PhoneNumberDesc $value) |
|
420 | |||
421 | 482 | public function hasVoip() |
|
422 | { |
||
423 | 482 | return isset($this->voip); |
|
424 | } |
||
425 | |||
426 | /** |
||
427 | * @return PhoneNumberDesc |
||
428 | */ |
||
429 | 1765 | public function getVoip() |
|
433 | |||
434 | 857 | public function setVoip(PhoneNumberDesc $value) |
|
439 | |||
440 | 482 | public function hasPager() |
|
441 | { |
||
442 | 482 | return isset($this->pager); |
|
443 | } |
||
444 | |||
445 | /** |
||
446 | * @return PhoneNumberDesc |
||
447 | */ |
||
448 | 1677 | public function getPager() |
|
452 | |||
453 | 857 | public function setPager(PhoneNumberDesc $value) |
|
458 | |||
459 | 482 | public function hasUan() |
|
460 | { |
||
461 | 482 | return isset($this->uan); |
|
462 | } |
||
463 | |||
464 | /** |
||
465 | * @return PhoneNumberDesc |
||
466 | */ |
||
467 | 1625 | public function getUan() |
|
471 | |||
472 | 857 | public function setUan(PhoneNumberDesc $value) |
|
477 | |||
478 | 756 | public function hasEmergency() |
|
482 | |||
483 | /** |
||
484 | * @return PhoneNumberDesc |
||
485 | */ |
||
486 | 513 | public function getEmergency() |
|
490 | |||
491 | 501 | public function setEmergency(PhoneNumberDesc $value) |
|
496 | |||
497 | 482 | public function hasVoicemail() |
|
498 | { |
||
499 | 482 | return isset($this->voicemail); |
|
500 | } |
||
501 | |||
502 | /** |
||
503 | * @return PhoneNumberDesc |
||
504 | */ |
||
505 | 1609 | public function getVoicemail() |
|
509 | |||
510 | 857 | public function setVoicemail(PhoneNumberDesc $value) |
|
515 | |||
516 | 482 | public function hasShortCode() |
|
517 | { |
||
518 | 482 | return isset($this->short_code); |
|
519 | } |
||
520 | |||
521 | 489 | public function getShortCode() |
|
525 | |||
526 | 501 | public function setShortCode(PhoneNumberDesc $value) |
|
531 | |||
532 | 482 | public function hasStandardRate() |
|
533 | { |
||
534 | 482 | return isset($this->standard_rate); |
|
535 | } |
||
536 | |||
537 | 766 | public function getStandardRate() |
|
541 | |||
542 | 501 | public function setStandardRate(PhoneNumberDesc $value) |
|
547 | |||
548 | 482 | public function hasCarrierSpecific() |
|
549 | { |
||
550 | 482 | return isset($this->carrierSpecific); |
|
551 | } |
||
552 | |||
553 | 477 | public function getCarrierSpecific() |
|
557 | |||
558 | 501 | public function setCarrierSpecific(PhoneNumberDesc $value) |
|
563 | |||
564 | 482 | public function hasNoInternationalDialling() |
|
565 | { |
||
566 | 482 | return isset($this->noInternationalDialling); |
|
567 | } |
||
568 | |||
569 | 490 | public function getNoInternationalDialling() |
|
573 | |||
574 | 857 | public function setNoInternationalDialling(PhoneNumberDesc $value) |
|
579 | |||
580 | /** |
||
581 | * @return string |
||
582 | */ |
||
583 | 494 | public function getId() |
|
587 | |||
588 | /** |
||
589 | * @param string $value |
||
590 | * @return PhoneMetadata |
||
591 | */ |
||
592 | 1355 | public function setId($value) |
|
597 | |||
598 | /** |
||
599 | * @return int |
||
600 | */ |
||
601 | 3216 | public function getCountryCode() |
|
605 | |||
606 | /** |
||
607 | * @param int $value |
||
608 | * @return PhoneMetadata |
||
609 | */ |
||
610 | 1355 | public function setCountryCode($value) |
|
615 | |||
616 | 3209 | public function getInternationalPrefix() |
|
620 | |||
621 | 1355 | public function setInternationalPrefix($value) |
|
626 | |||
627 | 485 | public function hasPreferredInternationalPrefix() |
|
631 | |||
632 | 27 | public function getPreferredInternationalPrefix() |
|
636 | |||
637 | 85 | public function setPreferredInternationalPrefix($value) |
|
642 | |||
643 | 484 | public function hasNationalPrefix() |
|
647 | |||
648 | 154 | public function getNationalPrefix() |
|
652 | |||
653 | 539 | public function setNationalPrefix($value) |
|
658 | |||
659 | 484 | public function hasPreferredExtnPrefix() |
|
663 | |||
664 | 10 | public function getPreferredExtnPrefix() |
|
668 | |||
669 | 93 | public function setPreferredExtnPrefix($value) |
|
674 | |||
675 | 485 | public function hasNationalPrefixForParsing() |
|
679 | |||
680 | 2890 | public function getNationalPrefixForParsing() |
|
684 | |||
685 | 555 | public function setNationalPrefixForParsing($value) |
|
690 | |||
691 | 482 | public function hasNationalPrefixTransformRule() |
|
692 | { |
||
693 | 482 | return isset($this->nationalPrefixTransformRule); |
|
694 | } |
||
695 | |||
696 | 77 | public function getNationalPrefixTransformRule() |
|
700 | |||
701 | 33 | public function setNationalPrefixTransformRule($value) |
|
706 | |||
707 | 1603 | public function isSameMobileAndFixedLinePattern() |
|
711 | |||
712 | 2 | public function setSameMobileAndFixedLinePattern($value) |
|
717 | |||
718 | /** |
||
719 | * @return NumberFormat[] |
||
720 | */ |
||
721 | 523 | public function numberFormats() |
|
725 | |||
726 | 526 | public function intlNumberFormats() |
|
730 | |||
731 | /** |
||
732 | * @return bool |
||
733 | */ |
||
734 | 1003 | public function hasLeadingDigits() |
|
738 | |||
739 | 201 | public function getLeadingDigits() |
|
743 | |||
744 | 80 | public function setLeadingDigits($value) |
|
749 | |||
750 | 486 | public function isLeadingZeroPossible() |
|
754 | |||
755 | 1349 | public function setLeadingZeroPossible($value) |
|
760 | |||
761 | 487 | public function isMobileNumberPortableRegion() |
|
765 | |||
766 | 1349 | public function setMobileNumberPortableRegion($value) |
|
771 | |||
772 | /** |
||
773 | * @param array $input |
||
774 | * @return PhoneMetadata |
||
775 | */ |
||
776 | 1348 | public function fromArray(array $input) |
|
777 | { |
||
778 | 1348 | if (isset($input['generalDesc'])) { |
|
779 | 1348 | $desc = new PhoneNumberDesc(); |
|
780 | 1348 | $this->setGeneralDesc($desc->fromArray($input['generalDesc'])); |
|
781 | 1348 | } |
|
782 | |||
783 | 1348 | if (isset($input['fixedLine'])) { |
|
784 | 855 | $desc = new PhoneNumberDesc(); |
|
785 | 855 | $this->setFixedLine($desc->fromArray($input['fixedLine'])); |
|
786 | 855 | } |
|
787 | |||
788 | 1348 | if (isset($input['mobile'])) { |
|
789 | 855 | $desc = new PhoneNumberDesc(); |
|
790 | 855 | $this->setMobile($desc->fromArray($input['mobile'])); |
|
791 | 855 | } |
|
792 | |||
793 | 1348 | if (isset($input['tollFree'])) { |
|
794 | 1348 | $desc = new PhoneNumberDesc(); |
|
795 | 1348 | $this->setTollFree($desc->fromArray($input['tollFree'])); |
|
796 | 1348 | } |
|
797 | |||
798 | 1348 | if (isset($input['premiumRate'])) { |
|
799 | 1348 | $desc = new PhoneNumberDesc(); |
|
800 | 1348 | $this->setPremiumRate($desc->fromArray($input['premiumRate'])); |
|
801 | 1348 | } |
|
802 | |||
803 | 1348 | if (isset($input['sharedCost'])) { |
|
804 | 855 | $desc = new PhoneNumberDesc(); |
|
805 | 855 | $this->setSharedCost($desc->fromArray($input['sharedCost'])); |
|
806 | 855 | } |
|
807 | |||
808 | 1348 | if (isset($input['personalNumber'])) { |
|
809 | 855 | $desc = new PhoneNumberDesc(); |
|
810 | 855 | $this->setPersonalNumber($desc->fromArray($input['personalNumber'])); |
|
811 | 855 | } |
|
812 | |||
813 | 1348 | if (isset($input['voip'])) { |
|
814 | 855 | $desc = new PhoneNumberDesc(); |
|
815 | 855 | $this->setVoip($desc->fromArray($input['voip'])); |
|
816 | 855 | } |
|
817 | |||
818 | 1348 | if (isset($input['pager'])) { |
|
819 | 855 | $desc = new PhoneNumberDesc(); |
|
820 | 855 | $this->setPager($desc->fromArray($input['pager'])); |
|
821 | 855 | } |
|
822 | |||
823 | 1348 | if (isset($input['uan'])) { |
|
824 | 855 | $desc = new PhoneNumberDesc(); |
|
825 | 855 | $this->setUan($desc->fromArray($input['uan'])); |
|
826 | 855 | } |
|
827 | |||
828 | 1348 | if (isset($input['emergency'])) { |
|
829 | 500 | $desc = new PhoneNumberDesc(); |
|
830 | 500 | $this->setEmergency($desc->fromArray($input['emergency'])); |
|
831 | 500 | } |
|
832 | |||
833 | 1348 | if (isset($input['voicemail'])) { |
|
834 | 855 | $desc = new PhoneNumberDesc(); |
|
835 | 855 | $this->setVoicemail($desc->fromArray($input['voicemail'])); |
|
836 | 855 | } |
|
837 | |||
838 | 1348 | if (isset($input['shortCode'])) { |
|
839 | 500 | $desc = new PhoneNumberDesc(); |
|
840 | 500 | $this->setShortCode(($desc->fromArray($input['shortCode']))); |
|
841 | 500 | } |
|
842 | |||
843 | 1348 | if (isset($input['standardRate'])) { |
|
844 | 500 | $desc = new PhoneNumberDesc(); |
|
845 | 500 | $this->setStandardRate($desc->fromArray($input['standardRate'])); |
|
846 | 500 | } |
|
847 | |||
848 | 1348 | if (isset($input['carrierSpecific'])) { |
|
849 | 500 | $desc = new PhoneNumberDesc(); |
|
850 | 500 | $this->setCarrierSpecific($desc->fromArray($input['carrierSpecific'])); |
|
851 | 500 | } |
|
852 | |||
853 | 1348 | if (isset($input['noInternationalDialling'])) { |
|
854 | 855 | $desc = new PhoneNumberDesc(); |
|
855 | 855 | $this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling'])); |
|
856 | 855 | } |
|
857 | |||
858 | 1348 | $this->setId($input['id']); |
|
859 | 1348 | $this->setCountryCode($input['countryCode']); |
|
860 | 1348 | $this->setInternationalPrefix($input['internationalPrefix']); |
|
861 | |||
862 | 1348 | if (isset($input['preferredInternationalPrefix'])) { |
|
863 | 84 | $this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']); |
|
864 | 84 | } |
|
865 | 1348 | if (isset($input['nationalPrefix'])) { |
|
866 | 536 | $this->setNationalPrefix($input['nationalPrefix']); |
|
867 | 536 | } |
|
868 | 1348 | if (isset($input['nationalPrefix'])) { |
|
869 | 536 | $this->setNationalPrefix($input['nationalPrefix']); |
|
870 | 536 | } |
|
871 | |||
872 | 1348 | if (isset($input['preferredExtnPrefix'])) { |
|
873 | 92 | $this->setPreferredExtnPrefix($input['preferredExtnPrefix']); |
|
874 | 92 | } |
|
875 | |||
876 | 1348 | if (isset($input['nationalPrefixForParsing'])) { |
|
877 | 551 | $this->setNationalPrefixForParsing($input['nationalPrefixForParsing']); |
|
878 | 551 | } |
|
879 | |||
880 | 1348 | if (isset($input['nationalPrefixTransformRule'])) { |
|
881 | 31 | $this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']); |
|
882 | 31 | } |
|
883 | |||
884 | 1348 | foreach ($input['numberFormat'] as $numberFormatElt) { |
|
885 | 754 | $numberFormat = new NumberFormat(); |
|
886 | 754 | $numberFormat->fromArray($numberFormatElt); |
|
887 | 754 | $this->addNumberFormat($numberFormat); |
|
888 | 1348 | } |
|
889 | |||
890 | 1348 | foreach ($input['intlNumberFormat'] as $intlNumberFormatElt) { |
|
891 | 137 | $numberFormat = new NumberFormat(); |
|
892 | 137 | $numberFormat->fromArray($intlNumberFormatElt); |
|
893 | 137 | $this->addIntlNumberFormat($numberFormat); |
|
894 | 1348 | } |
|
895 | |||
896 | 1348 | $this->setMainCountryForCode($input['mainCountryForCode']); |
|
897 | |||
898 | 1348 | if (isset($input['leadingDigits'])) { |
|
899 | 79 | $this->setLeadingDigits($input['leadingDigits']); |
|
900 | 79 | } |
|
901 | |||
902 | 1348 | if (isset($input['leadingZeroPossible'])) { |
|
903 | 1348 | $this->setLeadingZeroPossible($input['leadingZeroPossible']); |
|
904 | 1348 | } |
|
905 | |||
906 | 1348 | if (isset($input['mobileNumberPortableRegion'])) { |
|
907 | 1348 | $this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']); |
|
908 | 1348 | } |
|
909 | |||
910 | 1348 | return $this; |
|
911 | } |
||
912 | |||
913 | 762 | public function addNumberFormat(NumberFormat $value) |
|
918 | |||
919 | 149 | public function addIntlNumberFormat(NumberFormat $value) |
|
924 | } |
||
925 |