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 clearMainCountryForCode() |
|
112 | { |
||
113 | 482 | $this->mainCountryForCode = false; |
|
114 | return $this; |
||
115 | } |
||
116 | 482 | ||
117 | public function hasLeadingZeroPossible() |
||
118 | 482 | { |
|
119 | return isset($this->leadingZeroPossible); |
||
120 | } |
||
121 | 483 | ||
122 | public function hasMobileNumberPortableRegion() |
||
123 | 483 | { |
|
124 | return isset($this->mobileNumberPortableRegion); |
||
125 | } |
||
126 | 2 | ||
127 | public function hasSameMobileAndFixedLinePattern() |
||
128 | 2 | { |
|
129 | return isset($this->sameMobileAndFixedLinePattern); |
||
130 | } |
||
131 | |||
132 | public function numberFormatSize() |
||
133 | { |
||
134 | return count($this->numberFormat); |
||
135 | 11 | } |
|
136 | |||
137 | 11 | /** |
|
138 | * @param int $index |
||
139 | * @return NumberFormat |
||
140 | */ |
||
141 | public function getNumberFormat($index) |
||
142 | { |
||
143 | return $this->numberFormat[$index]; |
||
144 | } |
||
145 | 6 | ||
146 | public function intlNumberFormatSize() |
||
147 | 6 | { |
|
148 | return count($this->intlNumberFormat); |
||
149 | } |
||
150 | 7 | ||
151 | public function getIntlNumberFormat($index) |
||
155 | |||
156 | 482 | public function clearIntlNumberFormat() |
|
161 | 482 | ||
162 | public function toArray() |
||
163 | { |
||
164 | 482 | $output = array(); |
|
165 | 244 | ||
166 | if ($this->hasGeneralDesc()) { |
||
167 | $output['generalDesc'] = $this->getGeneralDesc()->toArray(); |
||
168 | 482 | } |
|
169 | 244 | ||
170 | if ($this->hasFixedLine()) { |
||
171 | $output['fixedLine'] = $this->getFixedLine()->toArray(); |
||
172 | 482 | } |
|
173 | 482 | ||
174 | if ($this->hasMobile()) { |
||
175 | $output['mobile'] = $this->getMobile()->toArray(); |
||
176 | 482 | } |
|
177 | 482 | ||
178 | if ($this->hasTollFree()) { |
||
179 | $output['tollFree'] = $this->getTollFree()->toArray(); |
||
180 | 482 | } |
|
181 | 482 | ||
182 | if ($this->hasPremiumRate()) { |
||
183 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
||
184 | 482 | } |
|
185 | 244 | ||
186 | if ($this->hasPremiumRate()) { |
||
187 | $output['premiumRate'] = $this->getPremiumRate()->toArray(); |
||
188 | 482 | } |
|
189 | 244 | ||
190 | if ($this->hasSharedCost()) { |
||
191 | $output['sharedCost'] = $this->getSharedCost()->toArray(); |
||
192 | 482 | } |
|
193 | 244 | ||
194 | if ($this->hasPersonalNumber()) { |
||
195 | $output['personalNumber'] = $this->getPersonalNumber()->toArray(); |
||
196 | 482 | } |
|
197 | 244 | ||
198 | if ($this->hasVoip()) { |
||
199 | $output['voip'] = $this->getVoip()->toArray(); |
||
200 | 482 | } |
|
201 | 244 | ||
202 | if ($this->hasPager()) { |
||
203 | $output['pager'] = $this->getPager()->toArray(); |
||
204 | 482 | } |
|
205 | 238 | ||
206 | if ($this->hasUan()) { |
||
207 | $output['uan'] = $this->getUan()->toArray(); |
||
208 | 482 | } |
|
209 | 244 | ||
210 | if ($this->hasEmergency()) { |
||
211 | $output['emergency'] = $this->getEmergency()->toArray(); |
||
212 | 482 | } |
|
213 | 238 | ||
214 | if ($this->hasVoicemail()) { |
||
215 | $output['voicemail'] = $this->getVoicemail()->toArray(); |
||
216 | 482 | } |
|
217 | 238 | ||
218 | if ($this->hasShortCode()) { |
||
219 | $output['shortCode'] = $this->getShortCode()->toArray(); |
||
220 | 482 | } |
|
221 | 238 | ||
222 | if ($this->hasStandardRate()) { |
||
223 | $output['standardRate'] = $this->getStandardRate()->toArray(); |
||
224 | 482 | } |
|
225 | 244 | ||
226 | if ($this->hasCarrierSpecific()) { |
||
227 | $output['carrierSpecific'] = $this->getCarrierSpecific()->toArray(); |
||
228 | 482 | } |
|
229 | 482 | ||
230 | 482 | if ($this->hasNoInternationalDialling()) { |
|
231 | $output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray(); |
||
232 | } |
||
233 | 482 | ||
234 | 482 | $output['id'] = $this->getId(); |
|
235 | if ($this->hasCountryCode()) { |
||
236 | $output['countryCode'] = $this->getCountryCode(); |
||
237 | 482 | } |
|
238 | 22 | ||
239 | if ($this->hasInternationalPrefix()) { |
||
240 | $output['internationalPrefix'] = $this->getInternationalPrefix(); |
||
241 | 482 | } |
|
242 | 146 | ||
243 | if ($this->hasPreferredInternationalPrefix()) { |
||
244 | $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix(); |
||
245 | 482 | } |
|
246 | 8 | ||
247 | if ($this->hasNationalPrefix()) { |
||
248 | $output['nationalPrefix'] = $this->getNationalPrefix(); |
||
249 | 482 | } |
|
250 | 151 | ||
251 | if ($this->hasPreferredExtnPrefix()) { |
||
252 | $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix(); |
||
253 | 482 | } |
|
254 | 4 | ||
255 | if ($this->hasNationalPrefixForParsing()) { |
||
256 | $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing(); |
||
257 | 482 | } |
|
258 | 482 | ||
259 | if ($this->hasNationalPrefixTransformRule()) { |
||
260 | $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule(); |
||
261 | 482 | } |
|
262 | 482 | ||
263 | 198 | if ($this->hasSameMobileAndFixedLinePattern()) { |
|
264 | $output['sameMobileAndFixedLinePattern'] = $this->isSameMobileAndFixedLinePattern(); |
||
265 | } |
||
266 | 482 | ||
267 | 482 | $output['numberFormat'] = array(); |
|
268 | 15 | foreach ($this->numberFormats() as $numberFormat) { |
|
269 | $output['numberFormat'][] = $numberFormat->toArray(); |
||
270 | } |
||
271 | 482 | ||
272 | $output['intlNumberFormat'] = array(); |
||
273 | 482 | foreach ($this->intlNumberFormats() as $intlNumberFormat) { |
|
274 | 26 | $output['intlNumberFormat'][] = $intlNumberFormat->toArray(); |
|
275 | } |
||
276 | |||
277 | 482 | $output['mainCountryForCode'] = $this->getMainCountryForCode(); |
|
278 | 482 | ||
279 | if ($this->hasLeadingDigits()) { |
||
280 | $output['leadingDigits'] = $this->getLeadingDigits(); |
||
281 | 482 | } |
|
282 | 482 | ||
283 | if ($this->hasLeadingZeroPossible()) { |
||
284 | $output['leadingZeroPossible'] = $this->isLeadingZeroPossible(); |
||
285 | 482 | } |
|
286 | |||
287 | if ($this->hasMobileNumberPortableRegion()) { |
||
288 | 482 | $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion(); |
|
289 | } |
||
290 | 482 | ||
291 | return $output; |
||
292 | } |
||
293 | |||
294 | public function hasGeneralDesc() |
||
295 | { |
||
296 | 3263 | return isset($this->generalDesc); |
|
297 | } |
||
298 | 3263 | ||
299 | /** |
||
300 | * @return PhoneNumberDesc |
||
301 | 1354 | */ |
|
302 | public function getGeneralDesc() |
||
306 | |||
307 | 482 | public function setGeneralDesc(PhoneNumberDesc $value) |
|
308 | { |
||
309 | 482 | $this->generalDesc = $value; |
|
310 | return $this; |
||
311 | } |
||
312 | |||
313 | public function hasFixedLine() |
||
314 | { |
||
315 | 1764 | return isset($this->fixedLine); |
|
316 | } |
||
317 | 1764 | ||
318 | /** |
||
319 | * @return PhoneNumberDesc |
||
320 | 857 | */ |
|
321 | public function getFixedLine() |
||
325 | |||
326 | 482 | public function setFixedLine(PhoneNumberDesc $value) |
|
327 | { |
||
328 | 482 | $this->fixedLine = $value; |
|
329 | return $this; |
||
330 | } |
||
331 | |||
332 | public function hasMobile() |
||
333 | { |
||
334 | 1372 | return isset($this->mobile); |
|
335 | } |
||
336 | 1372 | ||
337 | /** |
||
338 | * @return PhoneNumberDesc |
||
339 | 857 | */ |
|
340 | public function getMobile() |
||
344 | |||
345 | 482 | public function setMobile(PhoneNumberDesc $value) |
|
346 | { |
||
347 | 482 | $this->mobile = $value; |
|
348 | return $this; |
||
349 | } |
||
350 | |||
351 | public function hasTollFree() |
||
352 | { |
||
353 | 2632 | return isset($this->tollFree); |
|
354 | } |
||
355 | 2632 | ||
356 | /** |
||
357 | * @return PhoneNumberDesc |
||
358 | 1351 | */ |
|
359 | public function getTollFree() |
||
363 | |||
364 | 482 | public function setTollFree(PhoneNumberDesc $value) |
|
365 | { |
||
366 | 482 | $this->tollFree = $value; |
|
367 | return $this; |
||
368 | } |
||
369 | |||
370 | public function hasPremiumRate() |
||
371 | { |
||
372 | 2860 | return isset($this->premiumRate); |
|
373 | } |
||
374 | 2860 | ||
375 | /** |
||
376 | * @return PhoneNumberDesc |
||
377 | 1351 | */ |
|
378 | public function getPremiumRate() |
||
382 | |||
383 | 482 | public function setPremiumRate(PhoneNumberDesc $value) |
|
384 | { |
||
385 | 482 | $this->premiumRate = $value; |
|
386 | return $this; |
||
387 | } |
||
388 | |||
389 | public function hasSharedCost() |
||
390 | { |
||
391 | 1848 | return isset($this->sharedCost); |
|
392 | } |
||
393 | 1848 | ||
394 | /** |
||
395 | * @return PhoneNumberDesc |
||
396 | 857 | */ |
|
397 | public function getSharedCost() |
||
401 | |||
402 | 482 | public function setSharedCost(PhoneNumberDesc $value) |
|
403 | { |
||
404 | 482 | $this->sharedCost = $value; |
|
405 | return $this; |
||
406 | } |
||
407 | |||
408 | public function hasPersonalNumber() |
||
409 | { |
||
410 | 1703 | return isset($this->personalNumber); |
|
411 | } |
||
412 | 1703 | ||
413 | /** |
||
414 | * @return PhoneNumberDesc |
||
415 | 857 | */ |
|
416 | public function getPersonalNumber() |
||
420 | |||
421 | 482 | public function setPersonalNumber(PhoneNumberDesc $value) |
|
422 | { |
||
423 | 482 | $this->personalNumber = $value; |
|
424 | return $this; |
||
425 | } |
||
426 | |||
427 | public function hasVoip() |
||
428 | { |
||
429 | 1766 | return isset($this->voip); |
|
430 | } |
||
431 | 1766 | ||
432 | /** |
||
433 | * @return PhoneNumberDesc |
||
434 | 857 | */ |
|
435 | public function getVoip() |
||
439 | |||
440 | 482 | public function setVoip(PhoneNumberDesc $value) |
|
441 | { |
||
442 | 482 | $this->voip = $value; |
|
443 | return $this; |
||
444 | } |
||
445 | |||
446 | public function hasPager() |
||
447 | { |
||
448 | 1678 | return isset($this->pager); |
|
449 | } |
||
450 | 1678 | ||
451 | /** |
||
452 | * @return PhoneNumberDesc |
||
453 | 857 | */ |
|
454 | public function getPager() |
||
458 | |||
459 | 482 | public function setPager(PhoneNumberDesc $value) |
|
460 | { |
||
461 | 482 | $this->pager = $value; |
|
462 | return $this; |
||
463 | } |
||
464 | |||
465 | public function hasUan() |
||
466 | { |
||
467 | 1625 | return isset($this->uan); |
|
468 | } |
||
469 | 1625 | ||
470 | /** |
||
471 | * @return PhoneNumberDesc |
||
472 | 857 | */ |
|
473 | public function getUan() |
||
477 | |||
478 | 756 | public function setUan(PhoneNumberDesc $value) |
|
479 | { |
||
480 | 756 | $this->uan = $value; |
|
481 | return $this; |
||
482 | } |
||
483 | |||
484 | public function hasEmergency() |
||
485 | { |
||
486 | 513 | return isset($this->emergency); |
|
487 | } |
||
488 | 513 | ||
489 | /** |
||
490 | * @return PhoneNumberDesc |
||
491 | 501 | */ |
|
492 | public function getEmergency() |
||
496 | |||
497 | 482 | public function setEmergency(PhoneNumberDesc $value) |
|
498 | { |
||
499 | 482 | $this->emergency = $value; |
|
500 | return $this; |
||
501 | } |
||
502 | |||
503 | public function hasVoicemail() |
||
504 | { |
||
505 | 1609 | return isset($this->voicemail); |
|
506 | } |
||
507 | 1609 | ||
508 | /** |
||
509 | * @return PhoneNumberDesc |
||
510 | 857 | */ |
|
511 | public function getVoicemail() |
||
515 | |||
516 | 482 | public function setVoicemail(PhoneNumberDesc $value) |
|
517 | { |
||
518 | 482 | $this->voicemail = $value; |
|
519 | return $this; |
||
520 | } |
||
521 | 489 | ||
522 | public function hasShortCode() |
||
523 | 489 | { |
|
524 | return isset($this->short_code); |
||
525 | } |
||
526 | 501 | ||
527 | public function getShortCode() |
||
531 | |||
532 | 482 | public function setShortCode(PhoneNumberDesc $value) |
|
533 | { |
||
534 | 482 | $this->short_code = $value; |
|
535 | return $this; |
||
536 | } |
||
537 | 766 | ||
538 | public function hasStandardRate() |
||
539 | 766 | { |
|
540 | return isset($this->standard_rate); |
||
541 | } |
||
542 | 501 | ||
543 | public function getStandardRate() |
||
547 | |||
548 | 482 | public function setStandardRate(PhoneNumberDesc $value) |
|
549 | { |
||
550 | 482 | $this->standard_rate = $value; |
|
551 | return $this; |
||
552 | } |
||
553 | 477 | ||
554 | public function hasCarrierSpecific() |
||
555 | 477 | { |
|
556 | return isset($this->carrierSpecific); |
||
557 | } |
||
558 | 501 | ||
559 | public function getCarrierSpecific() |
||
563 | |||
564 | 482 | public function setCarrierSpecific(PhoneNumberDesc $value) |
|
565 | { |
||
566 | 482 | $this->carrierSpecific = $value; |
|
567 | return $this; |
||
568 | } |
||
569 | 490 | ||
570 | public function hasNoInternationalDialling() |
||
571 | 490 | { |
|
572 | return isset($this->noInternationalDialling); |
||
573 | } |
||
574 | 857 | ||
575 | public function getNoInternationalDialling() |
||
579 | |||
580 | public function setNoInternationalDialling(PhoneNumberDesc $value) |
||
581 | { |
||
582 | $this->noInternationalDialling = $value; |
||
583 | 494 | return $this; |
|
584 | } |
||
585 | 494 | ||
586 | /** |
||
587 | * @return string |
||
588 | */ |
||
589 | public function getId() |
||
590 | { |
||
591 | return $this->id; |
||
592 | 1355 | } |
|
593 | |||
594 | 1355 | /** |
|
595 | 1355 | * @param string $value |
|
596 | * @return PhoneMetadata |
||
597 | */ |
||
598 | public function setId($value) |
||
599 | { |
||
600 | $this->id = $value; |
||
601 | 3217 | return $this; |
|
602 | } |
||
603 | 3217 | ||
604 | /** |
||
605 | * @return int |
||
606 | */ |
||
607 | public function getCountryCode() |
||
608 | { |
||
609 | return $this->countryCode; |
||
610 | 1355 | } |
|
611 | |||
612 | 1355 | /** |
|
613 | 1355 | * @param int $value |
|
614 | * @return PhoneMetadata |
||
615 | */ |
||
616 | 3210 | public function setCountryCode($value) |
|
617 | { |
||
618 | 3210 | $this->countryCode = $value; |
|
619 | return $this; |
||
620 | } |
||
621 | 1355 | ||
622 | public function getInternationalPrefix() |
||
626 | |||
627 | 485 | public function setInternationalPrefix($value) |
|
628 | { |
||
629 | 485 | $this->internationalPrefix = $value; |
|
630 | return $this; |
||
631 | } |
||
632 | 27 | ||
633 | public function hasPreferredInternationalPrefix() |
||
634 | 27 | { |
|
635 | return isset($this->preferredInternationalPrefix); |
||
636 | } |
||
637 | 85 | ||
638 | public function getPreferredInternationalPrefix() |
||
642 | |||
643 | 484 | public function setPreferredInternationalPrefix($value) |
|
644 | { |
||
645 | 484 | $this->preferredInternationalPrefix = $value; |
|
646 | return $this; |
||
647 | } |
||
648 | 154 | ||
649 | public function clearPreferredInternationalPrefix() |
||
650 | 154 | { |
|
651 | $this->preferredInternationalPrefix = ''; |
||
652 | return $this; |
||
653 | 539 | } |
|
654 | |||
655 | 539 | public function hasNationalPrefix() |
|
659 | 484 | ||
660 | public function getNationalPrefix() |
||
661 | 484 | { |
|
662 | return $this->nationalPrefix; |
||
663 | } |
||
664 | 10 | ||
665 | public function setNationalPrefix($value) |
||
666 | 10 | { |
|
667 | $this->nationalPrefix = $value; |
||
668 | return $this; |
||
669 | 93 | } |
|
670 | |||
671 | 93 | public function clearNationalPrefix() |
|
672 | 93 | { |
|
673 | $this->nationalPrefix = ''; |
||
674 | return $this; |
||
675 | 485 | } |
|
676 | |||
677 | 485 | public function hasPreferredExtnPrefix() |
|
681 | |||
682 | 2891 | public function getPreferredExtnPrefix() |
|
686 | |||
687 | 555 | public function setPreferredExtnPrefix($value) |
|
692 | |||
693 | 482 | public function clearPreferredExtnPrefix() |
|
694 | { |
||
695 | $this->preferredExtnPrefix = ''; |
||
696 | 77 | return $this; |
|
697 | } |
||
698 | 77 | ||
699 | public function hasNationalPrefixForParsing() |
||
700 | { |
||
701 | 33 | return isset($this->nationalPrefixForParsing); |
|
702 | } |
||
703 | 33 | ||
704 | 33 | public function getNationalPrefixForParsing() |
|
708 | |||
709 | 1603 | public function setNationalPrefixForParsing($value) |
|
710 | { |
||
711 | $this->nationalPrefixForParsing = $value; |
||
712 | 2 | return $this; |
|
713 | } |
||
714 | 2 | ||
715 | 2 | public function hasNationalPrefixTransformRule() |
|
716 | { |
||
717 | return isset($this->nationalPrefixTransformRule); |
||
718 | } |
||
719 | |||
720 | public function getNationalPrefixTransformRule() |
||
724 | |||
725 | public function setNationalPrefixTransformRule($value) |
||
726 | 526 | { |
|
727 | $this->nationalPrefixTransformRule = $value; |
||
728 | 526 | return $this; |
|
729 | } |
||
730 | |||
731 | public function clearNationalPrefixTransformRule() |
||
732 | { |
||
733 | $this->nationalPrefixTransformRule = ''; |
||
734 | 1003 | return $this; |
|
735 | } |
||
736 | 1003 | ||
737 | public function isSameMobileAndFixedLinePattern() |
||
738 | { |
||
739 | 201 | return $this->sameMobileAndFixedLinePattern; |
|
740 | } |
||
741 | 201 | ||
742 | public function setSameMobileAndFixedLinePattern($value) |
||
743 | { |
||
744 | 80 | $this->sameMobileAndFixedLinePattern = $value; |
|
745 | return $this; |
||
746 | 80 | } |
|
747 | 80 | ||
748 | public function clearSameMobileAndFixedLinePattern() |
||
749 | { |
||
750 | 486 | $this->sameMobileAndFixedLinePattern = false; |
|
751 | return $this; |
||
752 | 486 | } |
|
753 | |||
754 | /** |
||
755 | 1349 | * @return NumberFormat[] |
|
756 | */ |
||
757 | 1349 | public function numberFormats() |
|
761 | 487 | ||
762 | public function intlNumberFormats() |
||
763 | 487 | { |
|
764 | return $this->intlNumberFormat; |
||
765 | } |
||
766 | 1349 | ||
767 | /** |
||
768 | 1349 | * @return bool |
|
769 | 1349 | */ |
|
770 | public function hasLeadingDigits() |
||
771 | { |
||
772 | return isset($this->leadingDigits); |
||
773 | } |
||
774 | |||
775 | public function getLeadingDigits() |
||
779 | 1348 | ||
780 | 1348 | public function setLeadingDigits($value) |
|
785 | 855 | ||
786 | public function isLeadingZeroPossible() |
||
790 | 855 | ||
791 | public function setLeadingZeroPossible($value) |
||
796 | |||
797 | public function clearLeadingZeroPossible() |
||
802 | |||
803 | 1348 | public function isMobileNumberPortableRegion() |
|
804 | 855 | { |
|
805 | 855 | return $this->mobileNumberPortableRegion; |
|
806 | } |
||
807 | |||
808 | 1348 | public function setMobileNumberPortableRegion($value) |
|
813 | 1348 | ||
814 | 855 | public function clearMobileNumberPortableRegion() |
|
819 | 855 | ||
820 | 855 | /** |
|
821 | * @param array $input |
||
822 | * @return PhoneMetadata |
||
823 | 1348 | */ |
|
824 | 855 | public function fromArray(array $input) |
|
825 | 855 | { |
|
826 | if (isset($input['generalDesc'])) { |
||
827 | $desc = new PhoneNumberDesc(); |
||
828 | 1348 | $this->setGeneralDesc($desc->fromArray($input['generalDesc'])); |
|
829 | 500 | } |
|
830 | 500 | ||
831 | if (isset($input['fixedLine'])) { |
||
832 | $desc = new PhoneNumberDesc(); |
||
833 | 1348 | $this->setFixedLine($desc->fromArray($input['fixedLine'])); |
|
834 | 855 | } |
|
835 | 855 | ||
836 | if (isset($input['mobile'])) { |
||
837 | $desc = new PhoneNumberDesc(); |
||
838 | 1348 | $this->setMobile($desc->fromArray($input['mobile'])); |
|
839 | 500 | } |
|
840 | 500 | ||
841 | if (isset($input['tollFree'])) { |
||
842 | $desc = new PhoneNumberDesc(); |
||
843 | 1348 | $this->setTollFree($desc->fromArray($input['tollFree'])); |
|
844 | 500 | } |
|
845 | 500 | ||
846 | if (isset($input['premiumRate'])) { |
||
847 | $desc = new PhoneNumberDesc(); |
||
848 | 1348 | $this->setPremiumRate($desc->fromArray($input['premiumRate'])); |
|
849 | 500 | } |
|
850 | 500 | ||
851 | if (isset($input['sharedCost'])) { |
||
852 | $desc = new PhoneNumberDesc(); |
||
853 | 1348 | $this->setSharedCost($desc->fromArray($input['sharedCost'])); |
|
854 | 855 | } |
|
855 | 855 | ||
856 | if (isset($input['personalNumber'])) { |
||
857 | $desc = new PhoneNumberDesc(); |
||
858 | 1348 | $this->setPersonalNumber($desc->fromArray($input['personalNumber'])); |
|
859 | 1348 | } |
|
860 | 1348 | ||
861 | if (isset($input['voip'])) { |
||
862 | 1348 | $desc = new PhoneNumberDesc(); |
|
863 | 84 | $this->setVoip($desc->fromArray($input['voip'])); |
|
864 | } |
||
865 | 1348 | ||
866 | 536 | if (isset($input['pager'])) { |
|
867 | $desc = new PhoneNumberDesc(); |
||
868 | 1348 | $this->setPager($desc->fromArray($input['pager'])); |
|
869 | 536 | } |
|
870 | |||
871 | if (isset($input['uan'])) { |
||
872 | 1348 | $desc = new PhoneNumberDesc(); |
|
873 | 92 | $this->setUan($desc->fromArray($input['uan'])); |
|
874 | } |
||
875 | |||
876 | 1348 | if (isset($input['emergency'])) { |
|
877 | 551 | $desc = new PhoneNumberDesc(); |
|
878 | $this->setEmergency($desc->fromArray($input['emergency'])); |
||
879 | } |
||
880 | 1348 | ||
881 | 31 | if (isset($input['voicemail'])) { |
|
882 | $desc = new PhoneNumberDesc(); |
||
960 | |||
961 | public function addNumberFormat(NumberFormat $value) |
||
966 | |||
967 | public function addIntlNumberFormat(NumberFormat $value) |
||
972 | } |
||
973 |