Completed
Push — master ( 5117ae...fac286 )
by Joshua
27:26 queued 11:48
created

PhoneMetadata::fromArray()   F

Complexity

Conditions 28
Paths > 20000

Size

Total Lines 136
Code Lines 80

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 107
CRAP Score 28

Importance

Changes 0
Metric Value
dl 0
loc 136
ccs 107
cts 107
cp 1
rs 2
c 0
b 0
f 0
cc 28
eloc 80
nc 134217728
nop 1
crap 28

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace libphonenumber;
4
5
/**
6
 * Class PhoneMetadata
7
 * @package libphonenumber
8
 * @internal Used internally, and can change at any time
9
 */
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()
96
    {
97 2
        return $this->mainCountryForCode;
98
    }
99
100 482
    public function getMainCountryForCode()
101
    {
102 482
        return $this->mainCountryForCode;
103
    }
104
105 1349
    public function setMainCountryForCode($value)
106
    {
107 1349
        $this->mainCountryForCode = $value;
108 1349
        return $this;
109
    }
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()
122
    {
123 483
        return isset($this->sameMobileAndFixedLinePattern);
124
    }
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)
136
    {
137 11
        return $this->numberFormat[$index];
138
    }
139
140
    public function intlNumberFormatSize()
141
    {
142
        return count($this->intlNumberFormat);
143
    }
144
145 6
    public function getIntlNumberFormat($index)
146
    {
147 6
        return $this->intlNumberFormat[$index];
148
    }
149
150 7
    public function clearIntlNumberFormat()
151
    {
152 7
        $this->intlNumberFormat = array();
153 7
        return $this;
154
    }
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()
297
    {
298 3262
        return $this->generalDesc;
299
    }
300
301 1354
    public function setGeneralDesc(PhoneNumberDesc $value)
302
    {
303 1354
        $this->generalDesc = $value;
304 1354
        return $this;
305
    }
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()
316
    {
317 1764
        return $this->fixedLine;
318
    }
319
320 857
    public function setFixedLine(PhoneNumberDesc $value)
321
    {
322 857
        $this->fixedLine = $value;
323 857
        return $this;
324
    }
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()
335
    {
336 1372
        return $this->mobile;
337
    }
338
339 857
    public function setMobile(PhoneNumberDesc $value)
340
    {
341 857
        $this->mobile = $value;
342 857
        return $this;
343
    }
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()
354
    {
355 2631
        return $this->tollFree;
356
    }
357
358 1351
    public function setTollFree(PhoneNumberDesc $value)
359
    {
360 1351
        $this->tollFree = $value;
361 1351
        return $this;
362
    }
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()
373
    {
374 2859
        return $this->premiumRate;
375
    }
376
377 1351
    public function setPremiumRate(PhoneNumberDesc $value)
378
    {
379 1351
        $this->premiumRate = $value;
380 1351
        return $this;
381
    }
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()
392
    {
393 1846
        return $this->sharedCost;
394
    }
395
396 857
    public function setSharedCost(PhoneNumberDesc $value)
397
    {
398 857
        $this->sharedCost = $value;
399 857
        return $this;
400
    }
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()
411
    {
412 1702
        return $this->personalNumber;
413
    }
414
415 857
    public function setPersonalNumber(PhoneNumberDesc $value)
416
    {
417 857
        $this->personalNumber = $value;
418 857
        return $this;
419
    }
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()
430
    {
431 1765
        return $this->voip;
432
    }
433
434 857
    public function setVoip(PhoneNumberDesc $value)
435
    {
436 857
        $this->voip = $value;
437 857
        return $this;
438
    }
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()
449
    {
450 1677
        return $this->pager;
451
    }
452
453 857
    public function setPager(PhoneNumberDesc $value)
454
    {
455 857
        $this->pager = $value;
456 857
        return $this;
457
    }
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()
468
    {
469 1625
        return $this->uan;
470
    }
471
472 857
    public function setUan(PhoneNumberDesc $value)
473
    {
474 857
        $this->uan = $value;
475 857
        return $this;
476
    }
477
478 756
    public function hasEmergency()
479
    {
480 756
        return isset($this->emergency);
481
    }
482
483
    /**
484
     * @return PhoneNumberDesc
485
     */
486 513
    public function getEmergency()
487
    {
488 513
        return $this->emergency;
489
    }
490
491 501
    public function setEmergency(PhoneNumberDesc $value)
492
    {
493 501
        $this->emergency = $value;
494 501
        return $this;
495
    }
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()
506
    {
507 1609
        return $this->voicemail;
508
    }
509
510 857
    public function setVoicemail(PhoneNumberDesc $value)
511
    {
512 857
        $this->voicemail = $value;
513 857
        return $this;
514
    }
515
516 482
    public function hasShortCode()
517
    {
518 482
        return isset($this->short_code);
519
    }
520
521 489
    public function getShortCode()
522
    {
523 489
        return $this->short_code;
524
    }
525
526 501
    public function setShortCode(PhoneNumberDesc $value)
527
    {
528 501
        $this->short_code = $value;
529 501
        return $this;
530
    }
531
532 482
    public function hasStandardRate()
533
    {
534 482
        return isset($this->standard_rate);
535
    }
536
537 766
    public function getStandardRate()
538
    {
539 766
        return $this->standard_rate;
540
    }
541
542 501
    public function setStandardRate(PhoneNumberDesc $value)
543
    {
544 501
        $this->standard_rate = $value;
545 501
        return $this;
546
    }
547
548 482
    public function hasCarrierSpecific()
549
    {
550 482
        return isset($this->carrierSpecific);
551
    }
552
553 477
    public function getCarrierSpecific()
554
    {
555 477
        return $this->carrierSpecific;
556
    }
557
558 501
    public function setCarrierSpecific(PhoneNumberDesc $value)
559
    {
560 501
        $this->carrierSpecific = $value;
561 501
        return $this;
562
    }
563
564 482
    public function hasNoInternationalDialling()
565
    {
566 482
        return isset($this->noInternationalDialling);
567
    }
568
569 490
    public function getNoInternationalDialling()
570
    {
571 490
        return $this->noInternationalDialling;
572
    }
573
574 857
    public function setNoInternationalDialling(PhoneNumberDesc $value)
575
    {
576 857
        $this->noInternationalDialling = $value;
577 857
        return $this;
578
    }
579
580
    /**
581
     * @return string
582
     */
583 494
    public function getId()
584
    {
585 494
        return $this->id;
586
    }
587
588
    /**
589
     * @param string $value
590
     * @return PhoneMetadata
591
     */
592 1355
    public function setId($value)
593
    {
594 1355
        $this->id = $value;
595 1355
        return $this;
596
    }
597
598
    /**
599
     * @return int
600
     */
601 3216
    public function getCountryCode()
602
    {
603 3216
        return $this->countryCode;
604
    }
605
606
    /**
607
     * @param int $value
608
     * @return PhoneMetadata
609
     */
610 1355
    public function setCountryCode($value)
611
    {
612 1355
        $this->countryCode = $value;
613 1355
        return $this;
614
    }
615
616 3209
    public function getInternationalPrefix()
617
    {
618 3209
        return $this->internationalPrefix;
619
    }
620
621 1355
    public function setInternationalPrefix($value)
622
    {
623 1355
        $this->internationalPrefix = $value;
624 1355
        return $this;
625
    }
626
627 485
    public function hasPreferredInternationalPrefix()
628
    {
629 485
        return isset($this->preferredInternationalPrefix);
630
    }
631
632 27
    public function getPreferredInternationalPrefix()
633
    {
634 27
        return $this->preferredInternationalPrefix;
635
    }
636
637 85
    public function setPreferredInternationalPrefix($value)
638
    {
639 85
        $this->preferredInternationalPrefix = $value;
640 85
        return $this;
641
    }
642
643 484
    public function hasNationalPrefix()
644
    {
645 484
        return isset($this->nationalPrefix);
646
    }
647
648 154
    public function getNationalPrefix()
649
    {
650 154
        return $this->nationalPrefix;
651
    }
652
653 539
    public function setNationalPrefix($value)
654
    {
655 539
        $this->nationalPrefix = $value;
656 539
        return $this;
657
    }
658
659 484
    public function hasPreferredExtnPrefix()
660
    {
661 484
        return isset($this->preferredExtnPrefix);
662
    }
663
664 10
    public function getPreferredExtnPrefix()
665
    {
666 10
        return $this->preferredExtnPrefix;
667
    }
668
669 93
    public function setPreferredExtnPrefix($value)
670
    {
671 93
        $this->preferredExtnPrefix = $value;
672 93
        return $this;
673
    }
674
675 485
    public function hasNationalPrefixForParsing()
676
    {
677 485
        return isset($this->nationalPrefixForParsing);
678
    }
679
680 2890
    public function getNationalPrefixForParsing()
681
    {
682 2890
        return $this->nationalPrefixForParsing;
683
    }
684
685 555
    public function setNationalPrefixForParsing($value)
686
    {
687 555
        $this->nationalPrefixForParsing = $value;
688 555
        return $this;
689
    }
690
691 482
    public function hasNationalPrefixTransformRule()
692
    {
693 482
        return isset($this->nationalPrefixTransformRule);
694
    }
695
696 77
    public function getNationalPrefixTransformRule()
697
    {
698 77
        return $this->nationalPrefixTransformRule;
699
    }
700
701 33
    public function setNationalPrefixTransformRule($value)
702
    {
703 33
        $this->nationalPrefixTransformRule = $value;
704 33
        return $this;
705
    }
706
707 1603
    public function isSameMobileAndFixedLinePattern()
708
    {
709 1603
        return $this->sameMobileAndFixedLinePattern;
710
    }
711
712 2
    public function setSameMobileAndFixedLinePattern($value)
713
    {
714 2
        $this->sameMobileAndFixedLinePattern = $value;
715 2
        return $this;
716
    }
717
718
    /**
719
     * @return NumberFormat[]
720
     */
721 523
    public function numberFormats()
722
    {
723 523
        return $this->numberFormat;
724
    }
725
726 526
    public function intlNumberFormats()
727
    {
728 526
        return $this->intlNumberFormat;
729
    }
730
731
    /**
732
     * @return bool
733
     */
734 1003
    public function hasLeadingDigits()
735
    {
736 1003
        return isset($this->leadingDigits);
737
    }
738
739 201
    public function getLeadingDigits()
740
    {
741 201
        return $this->leadingDigits;
742
    }
743
744 80
    public function setLeadingDigits($value)
745
    {
746 80
        $this->leadingDigits = $value;
747 80
        return $this;
748
    }
749
750 486
    public function isLeadingZeroPossible()
751
    {
752 486
        return $this->leadingZeroPossible;
753
    }
754
755 1349
    public function setLeadingZeroPossible($value)
756
    {
757 1349
        $this->leadingZeroPossible = $value;
758 1349
        return $this;
759
    }
760
761 487
    public function isMobileNumberPortableRegion()
762
    {
763 487
        return $this->mobileNumberPortableRegion;
764
    }
765
766 1349
    public function setMobileNumberPortableRegion($value)
767
    {
768 1349
        $this->mobileNumberPortableRegion = $value;
769 1349
        return $this;
770
    }
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)
914
    {
915 762
        $this->numberFormat[] = $value;
916 762
        return $this;
917
    }
918
919 149
    public function addIntlNumberFormat(NumberFormat $value)
920
    {
921 149
        $this->intlNumberFormat[] = $value;
922 149
        return $this;
923
    }
924
}
925