Completed
Push — metadata-toArray ( 786ee6 )
by Joshua
16:04
created

PhoneMetadata   D

Complexity

Total Complexity 156

Size/Duplication

Total Lines 915
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 69.17%

Importance

Changes 0
Metric Value
wmc 156
lcom 1
cbo 2
dl 0
loc 915
ccs 258
cts 373
cp 0.6917
rs 4.4444
c 0
b 0
f 0

99 Methods

Rating   Name   Duplication   Size   Complexity  
A isMainCountryForCode() 0 4 1
A setMainCountryForCode() 0 5 1
A hasSameMobileAndFixedLinePattern() 0 4 1
A getNumberFormat() 0 4 1
A getIntlNumberFormat() 0 4 1
A clearIntlNumberFormat() 0 5 1
A hasId() 0 4 1
A hasCountryCode() 0 4 1
A hasInternationalPrefix() 0 4 1
A hasMainCountryForCode() 0 4 1
A getMainCountryForCode() 0 4 1
A hasLeadingZeroPossible() 0 4 1
A hasMobileNumberPortableRegion() 0 4 1
A numberFormatSize() 0 4 1
A intlNumberFormatSize() 0 4 1
F toArray() 0 131 31
A hasGeneralDesc() 0 4 1
A getGeneralDesc() 0 4 1
A setGeneralDesc() 0 5 1
A hasFixedLine() 0 4 1
A getFixedLine() 0 4 1
A setFixedLine() 0 5 1
A hasMobile() 0 4 1
A getMobile() 0 4 1
A setMobile() 0 5 1
A hasTollFree() 0 4 1
A getTollFree() 0 4 1
A setTollFree() 0 5 1
A hasPremiumRate() 0 4 1
A getPremiumRate() 0 4 1
A setPremiumRate() 0 5 1
A hasSharedCost() 0 4 1
A getSharedCost() 0 4 1
A setSharedCost() 0 5 1
A hasPersonalNumber() 0 4 1
A getPersonalNumber() 0 4 1
A setPersonalNumber() 0 5 1
A hasVoip() 0 4 1
A getVoip() 0 4 1
A setVoip() 0 5 1
A hasPager() 0 4 1
A getPager() 0 4 1
A setPager() 0 5 1
A hasUan() 0 4 1
A getUan() 0 4 1
A setUan() 0 5 1
A hasEmergency() 0 4 1
A getEmergency() 0 4 1
A setEmergency() 0 5 1
A hasVoicemail() 0 4 1
A getVoicemail() 0 4 1
A setVoicemail() 0 5 1
A hasShortCode() 0 4 1
A getShortCode() 0 4 1
A setShortCode() 0 5 1
A hasStandardRate() 0 4 1
A getStandardRate() 0 4 1
A setStandardRate() 0 5 1
A hasCarrierSpecific() 0 4 1
A getCarrierSpecific() 0 4 1
A setCarrierSpecific() 0 5 1
A hasNoInternationalDialling() 0 4 1
A getNoInternationalDialling() 0 4 1
A setNoInternationalDialling() 0 5 1
A getId() 0 4 1
A setId() 0 5 1
A getCountryCode() 0 4 1
A setCountryCode() 0 5 1
A getInternationalPrefix() 0 4 1
A setInternationalPrefix() 0 5 1
A hasPreferredInternationalPrefix() 0 4 1
A getPreferredInternationalPrefix() 0 4 1
A setPreferredInternationalPrefix() 0 5 1
A hasNationalPrefix() 0 4 1
A getNationalPrefix() 0 4 1
A setNationalPrefix() 0 5 1
A hasPreferredExtnPrefix() 0 4 1
A getPreferredExtnPrefix() 0 4 1
A setPreferredExtnPrefix() 0 5 1
A hasNationalPrefixForParsing() 0 4 1
A getNationalPrefixForParsing() 0 4 1
A setNationalPrefixForParsing() 0 5 1
A hasNationalPrefixTransformRule() 0 4 1
A getNationalPrefixTransformRule() 0 4 1
A setNationalPrefixTransformRule() 0 5 1
A isSameMobileAndFixedLinePattern() 0 4 1
A setSameMobileAndFixedLinePattern() 0 5 1
A numberFormats() 0 4 1
A intlNumberFormats() 0 4 1
A hasLeadingDigits() 0 4 1
A getLeadingDigits() 0 4 1
A setLeadingDigits() 0 5 1
A isLeadingZeroPossible() 0 4 1
A setLeadingZeroPossible() 0 5 1
A isMobileNumberPortableRegion() 0 4 1
A setMobileNumberPortableRegion() 0 5 1
F fromArray() 0 136 28
A addNumberFormat() 0 5 1
A addIntlNumberFormat() 0 5 1

How to fix   Complexity   

Complex Class

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