PhoneMetadata::toArray()   D
last analyzed

Complexity

Conditions 32
Paths 0

Size

Total Lines 134
Code Lines 68

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 69
CRAP Score 32

Importance

Changes 0
Metric Value
cc 32
eloc 68
nc 0
nop 0
dl 0
loc 134
ccs 69
cts 69
cp 1
crap 32
rs 4.1666
c 0
b 0
f 0

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;
16
    /**
17
     * @var int
18
     */
19
    protected $countryCode;
20
    protected $leadingDigits;
21
    protected $internationalPrefix;
22
    protected $preferredInternationalPrefix;
23
    protected $nationalPrefixForParsing;
24
    protected $nationalPrefixTransformRule;
25
    protected $nationalPrefix;
26
    protected $preferredExtnPrefix;
27
    protected $mainCountryForCode = false;
28
    protected $leadingZeroPossible = false;
29
    protected $mobileNumberPortableRegion = false;
30
    protected $generalDesc;
31
    /**
32
     * @var PhoneNumberDesc
33
     */
34
    protected $mobile;
35
    protected $premiumRate;
36
    protected $fixedLine;
37
    protected $sameMobileAndFixedLinePattern = false;
38
    protected $numberFormat = array();
39
    protected $tollFree;
40
    protected $sharedCost;
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 $smsServices;
63
    /**
64
     * @var PhoneNumberDesc
65
     */
66
    protected $noInternationalDialling;
67
    /**
68
     *
69
     * @var NumberFormat[]
70
     */
71
    protected $intlNumberFormat = array();
72
73
    /**
74
     * @return boolean
75
     */
76
    public function hasId()
77
    {
78
        return $this->id !== null;
79
    }
80
81
    /**
82
     * @return boolean
83
     */
84 486
    public function hasCountryCode()
85
    {
86 486
        return $this->countryCode !== null;
87
    }
88
89 486
    public function hasInternationalPrefix()
90
    {
91 486
        return $this->internationalPrefix !== null;
92
    }
93
94
    public function hasMainCountryForCode()
95
    {
96
        return $this->mainCountryForCode !== null;
97
    }
98
99 2
    public function isMainCountryForCode()
100
    {
101 2
        return $this->mainCountryForCode;
102
    }
103
104 486
    public function getMainCountryForCode()
105
    {
106 486
        return $this->mainCountryForCode;
107
    }
108
109 1583
    public function setMainCountryForCode($value)
110
    {
111 1583
        $this->mainCountryForCode = $value;
112 1583
        return $this;
113
    }
114
115 2
    public function clearMainCountryForCode()
116
    {
117 2
        $this->mainCountryForCode = false;
118 2
        return $this;
119
    }
120
121 486
    public function hasLeadingZeroPossible()
122
    {
123 486
        return $this->leadingZeroPossible !== null;
124
    }
125
126 486
    public function hasMobileNumberPortableRegion()
127
    {
128 486
        return $this->mobileNumberPortableRegion !== null;
129
    }
130
131 486
    public function hasSameMobileAndFixedLinePattern()
132
    {
133 486
        return $this->sameMobileAndFixedLinePattern !== null;
134
    }
135
136 2
    public function numberFormatSize()
137
    {
138 2
        return \count($this->numberFormat);
139
    }
140
141
    /**
142
     * @param int $index
143
     * @return NumberFormat
144
     */
145 11
    public function getNumberFormat($index)
146
    {
147 11
        return $this->numberFormat[$index];
148
    }
149
150 20
    public function intlNumberFormatSize()
151
    {
152 20
        return \count($this->intlNumberFormat);
153
    }
154
155 6
    public function getIntlNumberFormat($index)
156
    {
157 6
        return $this->intlNumberFormat[$index];
158
    }
159
160 7
    public function clearIntlNumberFormat()
161
    {
162 7
        $this->intlNumberFormat = array();
163 7
        return $this;
164
    }
165
166 486
    public function toArray()
167
    {
168 486
        $output = array();
169
170 486
        if ($this->hasGeneralDesc()) {
171 486
            $output['generalDesc'] = $this->getGeneralDesc()->toArray();
172
        }
173
174 486
        if ($this->hasFixedLine()) {
175 245
            $output['fixedLine'] = $this->getFixedLine()->toArray();
176
        }
177
178 486
        if ($this->hasMobile()) {
179 245
            $output['mobile'] = $this->getMobile()->toArray();
180
        }
181
182 486
        if ($this->hasTollFree()) {
183 486
            $output['tollFree'] = $this->getTollFree()->toArray();
184
        }
185
186 486
        if ($this->hasPremiumRate()) {
187 486
            $output['premiumRate'] = $this->getPremiumRate()->toArray();
188
        }
189
190 486
        if ($this->hasPremiumRate()) {
191 486
            $output['premiumRate'] = $this->getPremiumRate()->toArray();
192
        }
193
194 486
        if ($this->hasSharedCost()) {
195 245
            $output['sharedCost'] = $this->getSharedCost()->toArray();
196
        }
197
198 486
        if ($this->hasPersonalNumber()) {
199 245
            $output['personalNumber'] = $this->getPersonalNumber()->toArray();
200
        }
201
202 486
        if ($this->hasVoip()) {
203 245
            $output['voip'] = $this->getVoip()->toArray();
204
        }
205
206 486
        if ($this->hasPager()) {
207 245
            $output['pager'] = $this->getPager()->toArray();
208
        }
209
210 486
        if ($this->hasUan()) {
211 245
            $output['uan'] = $this->getUan()->toArray();
212
        }
213
214 486
        if ($this->hasEmergency()) {
215 241
            $output['emergency'] = $this->getEmergency()->toArray();
216
        }
217
218 486
        if ($this->hasVoicemail()) {
219 245
            $output['voicemail'] = $this->getVoicemail()->toArray();
220
        }
221
222 486
        if ($this->hasShortCode()) {
223 241
            $output['shortCode'] = $this->getShortCode()->toArray();
224
        }
225
226 486
        if ($this->hasStandardRate()) {
227 241
            $output['standardRate'] = $this->getStandardRate()->toArray();
228
        }
229
230 486
        if ($this->hasCarrierSpecific()) {
231 241
            $output['carrierSpecific'] = $this->getCarrierSpecific()->toArray();
232
        }
233
234 486
        if ($this->hasSmsServices()) {
235 241
            $output['smsServices'] = $this->getSmsServices()->toArray();
236
        }
237
238 486
        if ($this->hasNoInternationalDialling()) {
239 245
            $output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray();
240
        }
241
242 486
        $output['id'] = $this->getId();
243 486
        if ($this->hasCountryCode()) {
244 486
            $output['countryCode'] = $this->getCountryCode();
245
        }
246
247 486
        if ($this->hasInternationalPrefix()) {
248 486
            $output['internationalPrefix'] = $this->getInternationalPrefix();
249
        }
250
251 486
        if ($this->hasPreferredInternationalPrefix()) {
252 26
            $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix();
253
        }
254
255 486
        if ($this->hasNationalPrefix()) {
256 146
            $output['nationalPrefix'] = $this->getNationalPrefix();
257
        }
258
259 486
        if ($this->hasPreferredExtnPrefix()) {
260 5
            $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix();
261
        }
262
263 486
        if ($this->hasNationalPrefixForParsing()) {
264 152
            $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing();
265
        }
266
267 486
        if ($this->hasNationalPrefixTransformRule()) {
268 31
            $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule();
269
        }
270
271 486
        if ($this->hasSameMobileAndFixedLinePattern()) {
272 486
            $output['sameMobileAndFixedLinePattern'] = $this->getSameMobileAndFixedLinePattern();
273
        }
274
275 486
        $output['numberFormat'] = array();
276 486
        foreach ($this->numberFormats() as $numberFormat) {
277 201
            $output['numberFormat'][] = $numberFormat->toArray();
278
        }
279
280 486
        $output['intlNumberFormat'] = array();
281 486
        foreach ($this->intlNumberFormats() as $intlNumberFormat) {
282 38
            $output['intlNumberFormat'][] = $intlNumberFormat->toArray();
283
        }
284
285 486
        $output['mainCountryForCode'] = $this->getMainCountryForCode();
286
287 486
        if ($this->hasLeadingDigits()) {
288 38
            $output['leadingDigits'] = $this->getLeadingDigits();
289
        }
290
291 486
        if ($this->hasLeadingZeroPossible()) {
292 486
            $output['leadingZeroPossible'] = $this->isLeadingZeroPossible();
293
        }
294
295 486
        if ($this->hasMobileNumberPortableRegion()) {
296 486
            $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion();
297
        }
298
299 486
        return $output;
300
    }
301
302 489
    public function hasGeneralDesc()
303
    {
304 489
        return $this->generalDesc !== null;
305
    }
306
307
    /**
308
     * @return PhoneNumberDesc
309
     */
310 3847
    public function getGeneralDesc()
311
    {
312 3847
        return $this->generalDesc;
313
    }
314
315 1594
    public function setGeneralDesc(PhoneNumberDesc $value)
316
    {
317 1594
        $this->generalDesc = $value;
318 1594
        return $this;
319
    }
320
321 492
    public function hasFixedLine()
322
    {
323 492
        return $this->fixedLine !== null;
324
    }
325
326
    /**
327
     * @return PhoneNumberDesc
328
     */
329 1874
    public function getFixedLine()
330
    {
331 1874
        return $this->fixedLine;
332
    }
333
334 1095
    public function setFixedLine(PhoneNumberDesc $value)
335
    {
336 1095
        $this->fixedLine = $value;
337 1095
        return $this;
338
    }
339
340 492
    public function hasMobile()
341
    {
342 492
        return $this->mobile !== null;
343
    }
344
345
    /**
346
     * @return PhoneNumberDesc
347
     */
348 1457
    public function getMobile()
349
    {
350 1457
        return $this->mobile;
351
    }
352
353 1095
    public function setMobile(PhoneNumberDesc $value)
354
    {
355 1095
        $this->mobile = $value;
356 1095
        return $this;
357
    }
358
359 492
    public function hasTollFree()
360
    {
361 492
        return $this->tollFree !== null;
362
    }
363
364
    /**
365
     * @return PhoneNumberDesc
366
     */
367 2737
    public function getTollFree()
368
    {
369 2737
        return $this->tollFree;
370
    }
371
372 1591
    public function setTollFree(PhoneNumberDesc $value)
373
    {
374 1591
        $this->tollFree = $value;
375 1591
        return $this;
376
    }
377
378 492
    public function hasPremiumRate()
379
    {
380 492
        return $this->premiumRate !== null;
381
    }
382
383
    /**
384
     * @return PhoneNumberDesc
385
     */
386 3199
    public function getPremiumRate()
387
    {
388 3199
        return $this->premiumRate;
389
    }
390
391 1588
    public function setPremiumRate(PhoneNumberDesc $value)
392
    {
393 1588
        $this->premiumRate = $value;
394 1588
        return $this;
395
    }
396
397 492
    public function hasSharedCost()
398
    {
399 492
        return $this->sharedCost !== null;
400
    }
401
402
    /**
403
     * @return PhoneNumberDesc
404
     */
405 1937
    public function getSharedCost()
406
    {
407 1937
        return $this->sharedCost;
408
    }
409
410 1092
    public function setSharedCost(PhoneNumberDesc $value)
411
    {
412 1092
        $this->sharedCost = $value;
413 1092
        return $this;
414
    }
415
416 492
    public function hasPersonalNumber()
417
    {
418 492
        return $this->personalNumber !== null;
419
    }
420
421
    /**
422
     * @return PhoneNumberDesc
423
     */
424 1782
    public function getPersonalNumber()
425
    {
426 1782
        return $this->personalNumber;
427
    }
428
429 1092
    public function setPersonalNumber(PhoneNumberDesc $value)
430
    {
431 1092
        $this->personalNumber = $value;
432 1092
        return $this;
433
    }
434
435 492
    public function hasVoip()
436
    {
437 492
        return $this->voip !== null;
438
    }
439
440
    /**
441
     * @return PhoneNumberDesc
442
     */
443 1843
    public function getVoip()
444
    {
445 1843
        return $this->voip;
446
    }
447
448 1092
    public function setVoip(PhoneNumberDesc $value)
449
    {
450 1092
        $this->voip = $value;
451 1092
        return $this;
452
    }
453
454 492
    public function hasPager()
455
    {
456 492
        return $this->pager !== null;
457
    }
458
459
    /**
460
     * @return PhoneNumberDesc
461
     */
462 1757
    public function getPager()
463
    {
464 1757
        return $this->pager;
465
    }
466
467 1092
    public function setPager(PhoneNumberDesc $value)
468
    {
469 1092
        $this->pager = $value;
470 1092
        return $this;
471
    }
472
473 492
    public function hasUan()
474
    {
475 492
        return $this->uan !== null;
476
    }
477
478
    /**
479
     * @return PhoneNumberDesc
480
     */
481 1700
    public function getUan()
482
    {
483 1700
        return $this->uan;
484
    }
485
486 1092
    public function setUan(PhoneNumberDesc $value)
487
    {
488 1092
        $this->uan = $value;
489 1092
        return $this;
490
    }
491
492 755
    public function hasEmergency()
493
    {
494 755
        return $this->emergency !== null;
495
    }
496
497
    /**
498
     * @return PhoneNumberDesc
499
     */
500 505
    public function getEmergency()
501
    {
502 505
        return $this->emergency;
503
    }
504
505 504
    public function setEmergency(PhoneNumberDesc $value)
506
    {
507 504
        $this->emergency = $value;
508 504
        return $this;
509
    }
510
511 492
    public function hasVoicemail()
512
    {
513 492
        return $this->voicemail !== null;
514
    }
515
516
    /**
517
     * @return PhoneNumberDesc
518
     */
519 1686
    public function getVoicemail()
520
    {
521 1686
        return $this->voicemail;
522
    }
523
524 1092
    public function setVoicemail(PhoneNumberDesc $value)
525
    {
526 1092
        $this->voicemail = $value;
527 1092
        return $this;
528
    }
529
530 492
    public function hasShortCode()
531
    {
532 492
        return $this->short_code !== null;
533
    }
534
535 490
    public function getShortCode()
536
    {
537 490
        return $this->short_code;
538
    }
539
540 504
    public function setShortCode(PhoneNumberDesc $value)
541
    {
542 504
        $this->short_code = $value;
543 504
        return $this;
544
    }
545
546 492
    public function hasStandardRate()
547
    {
548 492
        return $this->standard_rate !== null;
549
    }
550
551 967
    public function getStandardRate()
552
    {
553 967
        return $this->standard_rate;
554
    }
555
556 504
    public function setStandardRate(PhoneNumberDesc $value)
557
    {
558 504
        $this->standard_rate = $value;
559 504
        return $this;
560
    }
561
562 492
    public function hasCarrierSpecific()
563
    {
564 492
        return $this->carrierSpecific !== null;
565
    }
566
567 484
    public function getCarrierSpecific()
568
    {
569 484
        return $this->carrierSpecific;
570
    }
571
572 504
    public function setCarrierSpecific(PhoneNumberDesc $value)
573
    {
574 504
        $this->carrierSpecific = $value;
575 504
        return $this;
576
    }
577
578 492
    public function hasSmsServices()
579
    {
580 492
        return $this->smsServices !== null;
581
    }
582
583 484
    public function getSmsServices()
584
    {
585 484
        return $this->smsServices;
586
    }
587
588 504
    public function setSmsServices(PhoneNumberDesc $value)
589
    {
590 504
        $this->smsServices = $value;
591 504
        return $this;
592
    }
593
594 492
    public function hasNoInternationalDialling()
595
    {
596 492
        return $this->noInternationalDialling !== null;
597
    }
598
599 495
    public function getNoInternationalDialling()
600
    {
601 495
        return $this->noInternationalDialling;
602
    }
603
604 1092
    public function setNoInternationalDialling(PhoneNumberDesc $value)
605
    {
606 1092
        $this->noInternationalDialling = $value;
607 1092
        return $this;
608
    }
609
610
    /**
611
     * @return string
612
     */
613 504
    public function getId()
614
    {
615 504
        return $this->id;
616
    }
617
618
    /**
619
     * @param string $value
620
     * @return PhoneMetadata
621
     */
622 1595
    public function setId($value)
623
    {
624 1595
        $this->id = $value;
625 1595
        return $this;
626
    }
627
628
    /**
629
     * @return int
630
     */
631 3812
    public function getCountryCode()
632
    {
633 3812
        return $this->countryCode;
634
    }
635
636
    /**
637
     * @param int $value
638
     * @return PhoneMetadata
639
     */
640 1595
    public function setCountryCode($value)
641
    {
642 1595
        $this->countryCode = $value;
643 1595
        return $this;
644
    }
645
646 3811
    public function getInternationalPrefix()
647
    {
648 3811
        return $this->internationalPrefix;
649
    }
650
651 1595
    public function setInternationalPrefix($value)
652
    {
653 1595
        $this->internationalPrefix = $value;
654 1595
        return $this;
655
    }
656
657 494
    public function hasPreferredInternationalPrefix()
658
    {
659 494
        return ($this->preferredInternationalPrefix !== null);
660
    }
661
662 33
    public function getPreferredInternationalPrefix()
663
    {
664 33
        return $this->preferredInternationalPrefix;
665
    }
666
667 106
    public function setPreferredInternationalPrefix($value)
668
    {
669 106
        $this->preferredInternationalPrefix = $value;
670 106
        return $this;
671
    }
672
673 2
    public function clearPreferredInternationalPrefix()
674
    {
675 2
        $this->preferredInternationalPrefix = null;
676 2
        return $this;
677
    }
678
679 488
    public function hasNationalPrefix()
680
    {
681 488
        return $this->nationalPrefix !== null;
682
    }
683
684 179
    public function getNationalPrefix()
685
    {
686 179
        return $this->nationalPrefix;
687
    }
688
689 760
    public function setNationalPrefix($value)
690
    {
691 760
        $this->nationalPrefix = $value;
692 760
        return $this;
693
    }
694
695
    public function clearNationalPrefix()
696
    {
697
        $this->nationalPrefix = '';
698
        return $this;
699
    }
700
701 489
    public function hasPreferredExtnPrefix()
702
    {
703 489
        return $this->preferredExtnPrefix !== null;
704
    }
705
706 8
    public function getPreferredExtnPrefix()
707
    {
708 8
        return $this->preferredExtnPrefix;
709
    }
710
711 195
    public function setPreferredExtnPrefix($value)
712
    {
713 195
        $this->preferredExtnPrefix = $value;
714 195
        return $this;
715
    }
716
717 2
    public function clearPreferredExtnPrefix()
718
    {
719 2
        $this->preferredExtnPrefix = '';
720 2
        return $this;
721
    }
722
723 516
    public function hasNationalPrefixForParsing()
724
    {
725 516
        return $this->nationalPrefixForParsing !== null;
726
    }
727
728 3480
    public function getNationalPrefixForParsing()
729
    {
730 3480
        return $this->nationalPrefixForParsing;
731
    }
732
733 780
    public function setNationalPrefixForParsing($value)
734
    {
735 780
        $this->nationalPrefixForParsing = $value;
736 780
        return $this;
737
    }
738
739 486
    public function hasNationalPrefixTransformRule()
740
    {
741 486
        return $this->nationalPrefixTransformRule !== null;
742
    }
743
744 206
    public function getNationalPrefixTransformRule()
745
    {
746 206
        return $this->nationalPrefixTransformRule;
747
    }
748
749 142
    public function setNationalPrefixTransformRule($value)
750
    {
751 142
        $this->nationalPrefixTransformRule = $value;
752 142
        return $this;
753
    }
754
755 2
    public function clearNationalPrefixTransformRule()
756
    {
757 2
        $this->nationalPrefixTransformRule = '';
758 2
        return $this;
759
    }
760
761 1670
    public function getSameMobileAndFixedLinePattern()
762
    {
763 1670
        return $this->sameMobileAndFixedLinePattern;
764
    }
765
766 5
    public function setSameMobileAndFixedLinePattern($value)
767
    {
768 5
        $this->sameMobileAndFixedLinePattern = $value;
769 5
        return $this;
770
    }
771
772 2
    public function clearSameMobileAndFixedLinePattern()
773
    {
774 2
        $this->sameMobileAndFixedLinePattern = false;
775 2
        return $this;
776
    }
777
778
    /**
779
     * @return NumberFormat[]
780
     */
781 639
    public function numberFormats()
782
    {
783 639
        return $this->numberFormat;
784
    }
785
786 593
    public function intlNumberFormats()
787
    {
788 593
        return $this->intlNumberFormat;
789
    }
790
791
    /**
792
     * @return bool
793
     */
794 1083
    public function hasLeadingDigits()
795
    {
796 1083
        return $this->leadingDigits !== null;
797
    }
798
799 327
    public function getLeadingDigits()
800
    {
801 327
        return $this->leadingDigits;
802
    }
803
804 117
    public function setLeadingDigits($value)
805
    {
806 117
        $this->leadingDigits = $value;
807 117
        return $this;
808
    }
809
810 486
    public function isLeadingZeroPossible()
811
    {
812 486
        return $this->leadingZeroPossible;
813
    }
814
815 1582
    public function setLeadingZeroPossible($value)
816
    {
817 1582
        $this->leadingZeroPossible = $value;
818 1582
        return $this;
819
    }
820
821 2
    public function clearLeadingZeroPossible()
822
    {
823 2
        $this->leadingZeroPossible = false;
824 2
        return $this;
825
    }
826
827 491
    public function isMobileNumberPortableRegion()
828
    {
829 491
        return $this->mobileNumberPortableRegion;
830
    }
831
832 1583
    public function setMobileNumberPortableRegion($value)
833
    {
834 1583
        $this->mobileNumberPortableRegion = $value;
835 1583
        return $this;
836
    }
837
838 2
    public function clearMobileNumberPortableRegion()
839
    {
840 2
        $this->mobileNumberPortableRegion = false;
841 2
        return $this;
842
    }
843
844
    /**
845
     * @param array $input
846
     * @return PhoneMetadata
847
     */
848 1582
    public function fromArray(array $input)
849
    {
850 1582
        if (isset($input['generalDesc'])) {
851 1582
            $desc = new PhoneNumberDesc();
852 1582
            $this->setGeneralDesc($desc->fromArray($input['generalDesc']));
853
        }
854
855 1582
        if (isset($input['fixedLine'])) {
856 1087
            $desc = new PhoneNumberDesc();
857 1087
            $this->setFixedLine($desc->fromArray($input['fixedLine']));
858
        }
859
860 1582
        if (isset($input['mobile'])) {
861 1087
            $desc = new PhoneNumberDesc();
862 1087
            $this->setMobile($desc->fromArray($input['mobile']));
863
        }
864
865 1582
        if (isset($input['tollFree'])) {
866 1582
            $desc = new PhoneNumberDesc();
867 1582
            $this->setTollFree($desc->fromArray($input['tollFree']));
868
        }
869
870 1582
        if (isset($input['premiumRate'])) {
871 1582
            $desc = new PhoneNumberDesc();
872 1582
            $this->setPremiumRate($desc->fromArray($input['premiumRate']));
873
        }
874
875 1582
        if (isset($input['sharedCost'])) {
876 1087
            $desc = new PhoneNumberDesc();
877 1087
            $this->setSharedCost($desc->fromArray($input['sharedCost']));
878
        }
879
880 1582
        if (isset($input['personalNumber'])) {
881 1087
            $desc = new PhoneNumberDesc();
882 1087
            $this->setPersonalNumber($desc->fromArray($input['personalNumber']));
883
        }
884
885 1582
        if (isset($input['voip'])) {
886 1087
            $desc = new PhoneNumberDesc();
887 1087
            $this->setVoip($desc->fromArray($input['voip']));
888
        }
889
890 1582
        if (isset($input['pager'])) {
891 1087
            $desc = new PhoneNumberDesc();
892 1087
            $this->setPager($desc->fromArray($input['pager']));
893
        }
894
895 1582
        if (isset($input['uan'])) {
896 1087
            $desc = new PhoneNumberDesc();
897 1087
            $this->setUan($desc->fromArray($input['uan']));
898
        }
899
900 1582
        if (isset($input['emergency'])) {
901 503
            $desc = new PhoneNumberDesc();
902 503
            $this->setEmergency($desc->fromArray($input['emergency']));
903
        }
904
905 1582
        if (isset($input['voicemail'])) {
906 1087
            $desc = new PhoneNumberDesc();
907 1087
            $this->setVoicemail($desc->fromArray($input['voicemail']));
908
        }
909
910 1582
        if (isset($input['shortCode'])) {
911 503
            $desc = new PhoneNumberDesc();
912 503
            $this->setShortCode($desc->fromArray($input['shortCode']));
913
        }
914
915 1582
        if (isset($input['standardRate'])) {
916 503
            $desc = new PhoneNumberDesc();
917 503
            $this->setStandardRate($desc->fromArray($input['standardRate']));
918
        }
919
920 1582
        if (isset($input['carrierSpecific'])) {
921 503
            $desc = new PhoneNumberDesc();
922 503
            $this->setCarrierSpecific($desc->fromArray($input['carrierSpecific']));
923
        }
924
925 1582
        if (isset($input['smsServices'])) {
926 503
            $desc = new PhoneNumberDesc();
927 503
            $this->setSmsServices($desc->fromArray($input['smsServices']));
928
        }
929
930 1582
        if (isset($input['noInternationalDialling'])) {
931 1087
            $desc = new PhoneNumberDesc();
932 1087
            $this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling']));
933
        }
934
935 1582
        $this->setId($input['id']);
936 1582
        $this->setCountryCode($input['countryCode']);
937 1582
        $this->setInternationalPrefix($input['internationalPrefix']);
938
939 1582
        if (isset($input['preferredInternationalPrefix'])) {
940 102
            $this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']);
941
        }
942 1582
        if (isset($input['nationalPrefix'])) {
943 757
            $this->setNationalPrefix($input['nationalPrefix']);
944
        }
945 1582
        if (isset($input['nationalPrefix'])) {
946 757
            $this->setNationalPrefix($input['nationalPrefix']);
947
        }
948
949 1582
        if (isset($input['preferredExtnPrefix'])) {
950 194
            $this->setPreferredExtnPrefix($input['preferredExtnPrefix']);
951
        }
952
953 1582
        if (isset($input['nationalPrefixForParsing'])) {
954 776
            $this->setNationalPrefixForParsing($input['nationalPrefixForParsing']);
955
        }
956
957 1582
        if (isset($input['nationalPrefixTransformRule'])) {
958 140
            $this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']);
959
        }
960
961 1582
        foreach ($input['numberFormat'] as $numberFormatElt) {
962 989
            $numberFormat = new NumberFormat();
963 989
            $numberFormat->fromArray($numberFormatElt);
964 989
            $this->addNumberFormat($numberFormat);
965
        }
966
967 1582
        foreach ($input['intlNumberFormat'] as $intlNumberFormatElt) {
968 334
            $numberFormat = new NumberFormat();
969 334
            $numberFormat->fromArray($intlNumberFormatElt);
970 334
            $this->addIntlNumberFormat($numberFormat);
971
        }
972
973 1582
        $this->setMainCountryForCode($input['mainCountryForCode']);
974
975 1582
        if (isset($input['leadingDigits'])) {
976 116
            $this->setLeadingDigits($input['leadingDigits']);
977
        }
978
979 1582
        if (isset($input['leadingZeroPossible'])) {
980 1582
            $this->setLeadingZeroPossible($input['leadingZeroPossible']);
981
        }
982
983 1582
        if (isset($input['mobileNumberPortableRegion'])) {
984 1582
            $this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']);
985
        }
986
987 1582
        return $this;
988
    }
989
990 997
    public function addNumberFormat(NumberFormat $value)
991
    {
992 997
        $this->numberFormat[] = $value;
993 997
        return $this;
994
    }
995
996 346
    public function addIntlNumberFormat(NumberFormat $value)
997
    {
998 346
        $this->intlNumberFormat[] = $value;
999 346
        return $this;
1000
    }
1001
}
1002