PhoneMetadata.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. <?php
  2. namespace libphonenumber;
  3. /**
  4. * Class PhoneMetadata
  5. * @package libphonenumber
  6. * @internal Used internally, and can change at any time
  7. */
  8. class PhoneMetadata
  9. {
  10. /**
  11. * @var string
  12. */
  13. protected $id;
  14. /**
  15. * @var int
  16. */
  17. protected $countryCode;
  18. protected $leadingDigits;
  19. protected $internationalPrefix;
  20. protected $preferredInternationalPrefix;
  21. protected $nationalPrefixForParsing;
  22. protected $nationalPrefixTransformRule;
  23. protected $nationalPrefix;
  24. protected $preferredExtnPrefix;
  25. protected $mainCountryForCode = false;
  26. protected $mobileNumberPortableRegion = false;
  27. protected $generalDesc;
  28. /**
  29. * @var PhoneNumberDesc
  30. */
  31. protected $mobile;
  32. protected $premiumRate;
  33. protected $fixedLine;
  34. protected $sameMobileAndFixedLinePattern = false;
  35. protected $numberFormat = array();
  36. protected $tollFree;
  37. protected $sharedCost;
  38. protected $personalNumber;
  39. protected $voip;
  40. protected $pager;
  41. protected $uan;
  42. protected $emergency;
  43. protected $voicemail;
  44. /**
  45. * @var PhoneNumberDesc
  46. */
  47. protected $short_code;
  48. /**
  49. * @var PhoneNumberDesc
  50. */
  51. protected $standard_rate;
  52. /**
  53. * @var PhoneNumberDesc
  54. */
  55. protected $carrierSpecific;
  56. /**
  57. * @var PhoneNumberDesc
  58. */
  59. protected $smsServices;
  60. /**
  61. * @var PhoneNumberDesc
  62. */
  63. protected $noInternationalDialling;
  64. /**
  65. *
  66. * @var NumberFormat[]
  67. */
  68. protected $intlNumberFormat = array();
  69. /**
  70. * @return boolean
  71. */
  72. public function hasId()
  73. {
  74. return $this->id !== null;
  75. }
  76. /**
  77. * @return boolean
  78. */
  79. public function hasCountryCode()
  80. {
  81. return $this->countryCode !== null;
  82. }
  83. public function hasInternationalPrefix()
  84. {
  85. return $this->internationalPrefix !== null;
  86. }
  87. public function hasMainCountryForCode()
  88. {
  89. return $this->mainCountryForCode !== null;
  90. }
  91. public function isMainCountryForCode()
  92. {
  93. return $this->mainCountryForCode;
  94. }
  95. public function getMainCountryForCode()
  96. {
  97. return $this->mainCountryForCode;
  98. }
  99. public function setMainCountryForCode($value)
  100. {
  101. $this->mainCountryForCode = $value;
  102. return $this;
  103. }
  104. public function clearMainCountryForCode()
  105. {
  106. $this->mainCountryForCode = false;
  107. return $this;
  108. }
  109. public function hasMobileNumberPortableRegion()
  110. {
  111. return $this->mobileNumberPortableRegion !== null;
  112. }
  113. public function hasSameMobileAndFixedLinePattern()
  114. {
  115. return $this->sameMobileAndFixedLinePattern !== null;
  116. }
  117. public function numberFormatSize()
  118. {
  119. return \count($this->numberFormat);
  120. }
  121. /**
  122. * @param int $index
  123. * @return NumberFormat
  124. */
  125. public function getNumberFormat($index)
  126. {
  127. return $this->numberFormat[$index];
  128. }
  129. public function intlNumberFormatSize()
  130. {
  131. return \count($this->intlNumberFormat);
  132. }
  133. public function getIntlNumberFormat($index)
  134. {
  135. return $this->intlNumberFormat[$index];
  136. }
  137. public function clearIntlNumberFormat()
  138. {
  139. $this->intlNumberFormat = array();
  140. return $this;
  141. }
  142. public function toArray()
  143. {
  144. $output = array();
  145. if ($this->hasGeneralDesc()) {
  146. $output['generalDesc'] = $this->getGeneralDesc()->toArray();
  147. }
  148. if ($this->hasFixedLine()) {
  149. $output['fixedLine'] = $this->getFixedLine()->toArray();
  150. }
  151. if ($this->hasMobile()) {
  152. $output['mobile'] = $this->getMobile()->toArray();
  153. }
  154. if ($this->hasTollFree()) {
  155. $output['tollFree'] = $this->getTollFree()->toArray();
  156. }
  157. if ($this->hasPremiumRate()) {
  158. $output['premiumRate'] = $this->getPremiumRate()->toArray();
  159. }
  160. if ($this->hasPremiumRate()) {
  161. $output['premiumRate'] = $this->getPremiumRate()->toArray();
  162. }
  163. if ($this->hasSharedCost()) {
  164. $output['sharedCost'] = $this->getSharedCost()->toArray();
  165. }
  166. if ($this->hasPersonalNumber()) {
  167. $output['personalNumber'] = $this->getPersonalNumber()->toArray();
  168. }
  169. if ($this->hasVoip()) {
  170. $output['voip'] = $this->getVoip()->toArray();
  171. }
  172. if ($this->hasPager()) {
  173. $output['pager'] = $this->getPager()->toArray();
  174. }
  175. if ($this->hasUan()) {
  176. $output['uan'] = $this->getUan()->toArray();
  177. }
  178. if ($this->hasEmergency()) {
  179. $output['emergency'] = $this->getEmergency()->toArray();
  180. }
  181. if ($this->hasVoicemail()) {
  182. $output['voicemail'] = $this->getVoicemail()->toArray();
  183. }
  184. if ($this->hasShortCode()) {
  185. $output['shortCode'] = $this->getShortCode()->toArray();
  186. }
  187. if ($this->hasStandardRate()) {
  188. $output['standardRate'] = $this->getStandardRate()->toArray();
  189. }
  190. if ($this->hasCarrierSpecific()) {
  191. $output['carrierSpecific'] = $this->getCarrierSpecific()->toArray();
  192. }
  193. if ($this->hasSmsServices()) {
  194. $output['smsServices'] = $this->getSmsServices()->toArray();
  195. }
  196. if ($this->hasNoInternationalDialling()) {
  197. $output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray();
  198. }
  199. $output['id'] = $this->getId();
  200. if ($this->hasCountryCode()) {
  201. $output['countryCode'] = $this->getCountryCode();
  202. }
  203. if ($this->hasInternationalPrefix()) {
  204. $output['internationalPrefix'] = $this->getInternationalPrefix();
  205. }
  206. if ($this->hasPreferredInternationalPrefix()) {
  207. $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix();
  208. }
  209. if ($this->hasNationalPrefix()) {
  210. $output['nationalPrefix'] = $this->getNationalPrefix();
  211. }
  212. if ($this->hasPreferredExtnPrefix()) {
  213. $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix();
  214. }
  215. if ($this->hasNationalPrefixForParsing()) {
  216. $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing();
  217. }
  218. if ($this->hasNationalPrefixTransformRule()) {
  219. $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule();
  220. }
  221. if ($this->hasSameMobileAndFixedLinePattern()) {
  222. $output['sameMobileAndFixedLinePattern'] = $this->getSameMobileAndFixedLinePattern();
  223. }
  224. $output['numberFormat'] = array();
  225. foreach ($this->numberFormats() as $numberFormat) {
  226. $output['numberFormat'][] = $numberFormat->toArray();
  227. }
  228. $output['intlNumberFormat'] = array();
  229. foreach ($this->intlNumberFormats() as $intlNumberFormat) {
  230. $output['intlNumberFormat'][] = $intlNumberFormat->toArray();
  231. }
  232. $output['mainCountryForCode'] = $this->getMainCountryForCode();
  233. if ($this->hasLeadingDigits()) {
  234. $output['leadingDigits'] = $this->getLeadingDigits();
  235. }
  236. if ($this->hasMobileNumberPortableRegion()) {
  237. $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion();
  238. }
  239. return $output;
  240. }
  241. public function hasGeneralDesc()
  242. {
  243. return $this->generalDesc !== null;
  244. }
  245. /**
  246. * @return PhoneNumberDesc
  247. */
  248. public function getGeneralDesc()
  249. {
  250. return $this->generalDesc;
  251. }
  252. public function setGeneralDesc(PhoneNumberDesc $value)
  253. {
  254. $this->generalDesc = $value;
  255. return $this;
  256. }
  257. public function hasFixedLine()
  258. {
  259. return $this->fixedLine !== null;
  260. }
  261. /**
  262. * @return PhoneNumberDesc
  263. */
  264. public function getFixedLine()
  265. {
  266. return $this->fixedLine;
  267. }
  268. public function setFixedLine(PhoneNumberDesc $value)
  269. {
  270. $this->fixedLine = $value;
  271. return $this;
  272. }
  273. public function hasMobile()
  274. {
  275. return $this->mobile !== null;
  276. }
  277. /**
  278. * @return PhoneNumberDesc
  279. */
  280. public function getMobile()
  281. {
  282. return $this->mobile;
  283. }
  284. public function setMobile(PhoneNumberDesc $value)
  285. {
  286. $this->mobile = $value;
  287. return $this;
  288. }
  289. public function hasTollFree()
  290. {
  291. return $this->tollFree !== null;
  292. }
  293. /**
  294. * @return PhoneNumberDesc
  295. */
  296. public function getTollFree()
  297. {
  298. return $this->tollFree;
  299. }
  300. public function setTollFree(PhoneNumberDesc $value)
  301. {
  302. $this->tollFree = $value;
  303. return $this;
  304. }
  305. public function hasPremiumRate()
  306. {
  307. return $this->premiumRate !== null;
  308. }
  309. /**
  310. * @return PhoneNumberDesc
  311. */
  312. public function getPremiumRate()
  313. {
  314. return $this->premiumRate;
  315. }
  316. public function setPremiumRate(PhoneNumberDesc $value)
  317. {
  318. $this->premiumRate = $value;
  319. return $this;
  320. }
  321. public function hasSharedCost()
  322. {
  323. return $this->sharedCost !== null;
  324. }
  325. /**
  326. * @return PhoneNumberDesc
  327. */
  328. public function getSharedCost()
  329. {
  330. return $this->sharedCost;
  331. }
  332. public function setSharedCost(PhoneNumberDesc $value)
  333. {
  334. $this->sharedCost = $value;
  335. return $this;
  336. }
  337. public function hasPersonalNumber()
  338. {
  339. return $this->personalNumber !== null;
  340. }
  341. /**
  342. * @return PhoneNumberDesc
  343. */
  344. public function getPersonalNumber()
  345. {
  346. return $this->personalNumber;
  347. }
  348. public function setPersonalNumber(PhoneNumberDesc $value)
  349. {
  350. $this->personalNumber = $value;
  351. return $this;
  352. }
  353. public function hasVoip()
  354. {
  355. return $this->voip !== null;
  356. }
  357. /**
  358. * @return PhoneNumberDesc
  359. */
  360. public function getVoip()
  361. {
  362. return $this->voip;
  363. }
  364. public function setVoip(PhoneNumberDesc $value)
  365. {
  366. $this->voip = $value;
  367. return $this;
  368. }
  369. public function hasPager()
  370. {
  371. return $this->pager !== null;
  372. }
  373. /**
  374. * @return PhoneNumberDesc
  375. */
  376. public function getPager()
  377. {
  378. return $this->pager;
  379. }
  380. public function setPager(PhoneNumberDesc $value)
  381. {
  382. $this->pager = $value;
  383. return $this;
  384. }
  385. public function hasUan()
  386. {
  387. return $this->uan !== null;
  388. }
  389. /**
  390. * @return PhoneNumberDesc
  391. */
  392. public function getUan()
  393. {
  394. return $this->uan;
  395. }
  396. public function setUan(PhoneNumberDesc $value)
  397. {
  398. $this->uan = $value;
  399. return $this;
  400. }
  401. public function hasEmergency()
  402. {
  403. return $this->emergency !== null;
  404. }
  405. /**
  406. * @return PhoneNumberDesc
  407. */
  408. public function getEmergency()
  409. {
  410. return $this->emergency;
  411. }
  412. public function setEmergency(PhoneNumberDesc $value)
  413. {
  414. $this->emergency = $value;
  415. return $this;
  416. }
  417. public function hasVoicemail()
  418. {
  419. return $this->voicemail !== null;
  420. }
  421. /**
  422. * @return PhoneNumberDesc
  423. */
  424. public function getVoicemail()
  425. {
  426. return $this->voicemail;
  427. }
  428. public function setVoicemail(PhoneNumberDesc $value)
  429. {
  430. $this->voicemail = $value;
  431. return $this;
  432. }
  433. public function hasShortCode()
  434. {
  435. return $this->short_code !== null;
  436. }
  437. public function getShortCode()
  438. {
  439. return $this->short_code;
  440. }
  441. public function setShortCode(PhoneNumberDesc $value)
  442. {
  443. $this->short_code = $value;
  444. return $this;
  445. }
  446. public function hasStandardRate()
  447. {
  448. return $this->standard_rate !== null;
  449. }
  450. public function getStandardRate()
  451. {
  452. return $this->standard_rate;
  453. }
  454. public function setStandardRate(PhoneNumberDesc $value)
  455. {
  456. $this->standard_rate = $value;
  457. return $this;
  458. }
  459. public function hasCarrierSpecific()
  460. {
  461. return $this->carrierSpecific !== null;
  462. }
  463. public function getCarrierSpecific()
  464. {
  465. return $this->carrierSpecific;
  466. }
  467. public function setCarrierSpecific(PhoneNumberDesc $value)
  468. {
  469. $this->carrierSpecific = $value;
  470. return $this;
  471. }
  472. public function hasSmsServices()
  473. {
  474. return $this->smsServices !== null;
  475. }
  476. public function getSmsServices()
  477. {
  478. return $this->smsServices;
  479. }
  480. public function setSmsServices(PhoneNumberDesc $value)
  481. {
  482. $this->smsServices = $value;
  483. return $this;
  484. }
  485. public function hasNoInternationalDialling()
  486. {
  487. return $this->noInternationalDialling !== null;
  488. }
  489. public function getNoInternationalDialling()
  490. {
  491. return $this->noInternationalDialling;
  492. }
  493. public function setNoInternationalDialling(PhoneNumberDesc $value)
  494. {
  495. $this->noInternationalDialling = $value;
  496. return $this;
  497. }
  498. /**
  499. * @return string
  500. */
  501. public function getId()
  502. {
  503. return $this->id;
  504. }
  505. /**
  506. * @param string $value
  507. * @return PhoneMetadata
  508. */
  509. public function setId($value)
  510. {
  511. $this->id = $value;
  512. return $this;
  513. }
  514. /**
  515. * @return int
  516. */
  517. public function getCountryCode()
  518. {
  519. return $this->countryCode;
  520. }
  521. /**
  522. * @param int $value
  523. * @return PhoneMetadata
  524. */
  525. public function setCountryCode($value)
  526. {
  527. $this->countryCode = $value;
  528. return $this;
  529. }
  530. public function getInternationalPrefix()
  531. {
  532. return $this->internationalPrefix;
  533. }
  534. public function setInternationalPrefix($value)
  535. {
  536. $this->internationalPrefix = $value;
  537. return $this;
  538. }
  539. public function hasPreferredInternationalPrefix()
  540. {
  541. return ($this->preferredInternationalPrefix !== null);
  542. }
  543. public function getPreferredInternationalPrefix()
  544. {
  545. return $this->preferredInternationalPrefix;
  546. }
  547. public function setPreferredInternationalPrefix($value)
  548. {
  549. $this->preferredInternationalPrefix = $value;
  550. return $this;
  551. }
  552. public function clearPreferredInternationalPrefix()
  553. {
  554. $this->preferredInternationalPrefix = null;
  555. return $this;
  556. }
  557. public function hasNationalPrefix()
  558. {
  559. return $this->nationalPrefix !== null;
  560. }
  561. public function getNationalPrefix()
  562. {
  563. return $this->nationalPrefix;
  564. }
  565. public function setNationalPrefix($value)
  566. {
  567. $this->nationalPrefix = $value;
  568. return $this;
  569. }
  570. public function clearNationalPrefix()
  571. {
  572. $this->nationalPrefix = '';
  573. return $this;
  574. }
  575. public function hasPreferredExtnPrefix()
  576. {
  577. return $this->preferredExtnPrefix !== null;
  578. }
  579. public function getPreferredExtnPrefix()
  580. {
  581. return $this->preferredExtnPrefix;
  582. }
  583. public function setPreferredExtnPrefix($value)
  584. {
  585. $this->preferredExtnPrefix = $value;
  586. return $this;
  587. }
  588. public function clearPreferredExtnPrefix()
  589. {
  590. $this->preferredExtnPrefix = '';
  591. return $this;
  592. }
  593. public function hasNationalPrefixForParsing()
  594. {
  595. return $this->nationalPrefixForParsing !== null;
  596. }
  597. public function getNationalPrefixForParsing()
  598. {
  599. return $this->nationalPrefixForParsing;
  600. }
  601. public function setNationalPrefixForParsing($value)
  602. {
  603. $this->nationalPrefixForParsing = $value;
  604. return $this;
  605. }
  606. public function hasNationalPrefixTransformRule()
  607. {
  608. return $this->nationalPrefixTransformRule !== null;
  609. }
  610. public function getNationalPrefixTransformRule()
  611. {
  612. return $this->nationalPrefixTransformRule;
  613. }
  614. public function setNationalPrefixTransformRule($value)
  615. {
  616. $this->nationalPrefixTransformRule = $value;
  617. return $this;
  618. }
  619. public function clearNationalPrefixTransformRule()
  620. {
  621. $this->nationalPrefixTransformRule = '';
  622. return $this;
  623. }
  624. public function getSameMobileAndFixedLinePattern()
  625. {
  626. return $this->sameMobileAndFixedLinePattern;
  627. }
  628. public function setSameMobileAndFixedLinePattern($value)
  629. {
  630. $this->sameMobileAndFixedLinePattern = $value;
  631. return $this;
  632. }
  633. public function clearSameMobileAndFixedLinePattern()
  634. {
  635. $this->sameMobileAndFixedLinePattern = false;
  636. return $this;
  637. }
  638. /**
  639. * @return NumberFormat[]
  640. */
  641. public function numberFormats()
  642. {
  643. return $this->numberFormat;
  644. }
  645. public function intlNumberFormats()
  646. {
  647. return $this->intlNumberFormat;
  648. }
  649. /**
  650. * @return bool
  651. */
  652. public function hasLeadingDigits()
  653. {
  654. return $this->leadingDigits !== null;
  655. }
  656. public function getLeadingDigits()
  657. {
  658. return $this->leadingDigits;
  659. }
  660. public function setLeadingDigits($value)
  661. {
  662. $this->leadingDigits = $value;
  663. return $this;
  664. }
  665. public function isMobileNumberPortableRegion()
  666. {
  667. return $this->mobileNumberPortableRegion;
  668. }
  669. public function setMobileNumberPortableRegion($value)
  670. {
  671. $this->mobileNumberPortableRegion = $value;
  672. return $this;
  673. }
  674. public function clearMobileNumberPortableRegion()
  675. {
  676. $this->mobileNumberPortableRegion = false;
  677. return $this;
  678. }
  679. /**
  680. * @param array $input
  681. * @return PhoneMetadata
  682. */
  683. public function fromArray(array $input)
  684. {
  685. if (isset($input['generalDesc'])) {
  686. $desc = new PhoneNumberDesc();
  687. $this->setGeneralDesc($desc->fromArray($input['generalDesc']));
  688. }
  689. if (isset($input['fixedLine'])) {
  690. $desc = new PhoneNumberDesc();
  691. $this->setFixedLine($desc->fromArray($input['fixedLine']));
  692. }
  693. if (isset($input['mobile'])) {
  694. $desc = new PhoneNumberDesc();
  695. $this->setMobile($desc->fromArray($input['mobile']));
  696. }
  697. if (isset($input['tollFree'])) {
  698. $desc = new PhoneNumberDesc();
  699. $this->setTollFree($desc->fromArray($input['tollFree']));
  700. }
  701. if (isset($input['premiumRate'])) {
  702. $desc = new PhoneNumberDesc();
  703. $this->setPremiumRate($desc->fromArray($input['premiumRate']));
  704. }
  705. if (isset($input['sharedCost'])) {
  706. $desc = new PhoneNumberDesc();
  707. $this->setSharedCost($desc->fromArray($input['sharedCost']));
  708. }
  709. if (isset($input['personalNumber'])) {
  710. $desc = new PhoneNumberDesc();
  711. $this->setPersonalNumber($desc->fromArray($input['personalNumber']));
  712. }
  713. if (isset($input['voip'])) {
  714. $desc = new PhoneNumberDesc();
  715. $this->setVoip($desc->fromArray($input['voip']));
  716. }
  717. if (isset($input['pager'])) {
  718. $desc = new PhoneNumberDesc();
  719. $this->setPager($desc->fromArray($input['pager']));
  720. }
  721. if (isset($input['uan'])) {
  722. $desc = new PhoneNumberDesc();
  723. $this->setUan($desc->fromArray($input['uan']));
  724. }
  725. if (isset($input['emergency'])) {
  726. $desc = new PhoneNumberDesc();
  727. $this->setEmergency($desc->fromArray($input['emergency']));
  728. }
  729. if (isset($input['voicemail'])) {
  730. $desc = new PhoneNumberDesc();
  731. $this->setVoicemail($desc->fromArray($input['voicemail']));
  732. }
  733. if (isset($input['shortCode'])) {
  734. $desc = new PhoneNumberDesc();
  735. $this->setShortCode($desc->fromArray($input['shortCode']));
  736. }
  737. if (isset($input['standardRate'])) {
  738. $desc = new PhoneNumberDesc();
  739. $this->setStandardRate($desc->fromArray($input['standardRate']));
  740. }
  741. if (isset($input['carrierSpecific'])) {
  742. $desc = new PhoneNumberDesc();
  743. $this->setCarrierSpecific($desc->fromArray($input['carrierSpecific']));
  744. }
  745. if (isset($input['smsServices'])) {
  746. $desc = new PhoneNumberDesc();
  747. $this->setSmsServices($desc->fromArray($input['smsServices']));
  748. }
  749. if (isset($input['noInternationalDialling'])) {
  750. $desc = new PhoneNumberDesc();
  751. $this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling']));
  752. }
  753. $this->setId($input['id']);
  754. $this->setCountryCode($input['countryCode']);
  755. $this->setInternationalPrefix($input['internationalPrefix']);
  756. if (isset($input['preferredInternationalPrefix'])) {
  757. $this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']);
  758. }
  759. if (isset($input['nationalPrefix'])) {
  760. $this->setNationalPrefix($input['nationalPrefix']);
  761. }
  762. if (isset($input['nationalPrefix'])) {
  763. $this->setNationalPrefix($input['nationalPrefix']);
  764. }
  765. if (isset($input['preferredExtnPrefix'])) {
  766. $this->setPreferredExtnPrefix($input['preferredExtnPrefix']);
  767. }
  768. if (isset($input['nationalPrefixForParsing'])) {
  769. $this->setNationalPrefixForParsing($input['nationalPrefixForParsing']);
  770. }
  771. if (isset($input['nationalPrefixTransformRule'])) {
  772. $this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']);
  773. }
  774. foreach ($input['numberFormat'] as $numberFormatElt) {
  775. $numberFormat = new NumberFormat();
  776. $numberFormat->fromArray($numberFormatElt);
  777. $this->addNumberFormat($numberFormat);
  778. }
  779. foreach ($input['intlNumberFormat'] as $intlNumberFormatElt) {
  780. $numberFormat = new NumberFormat();
  781. $numberFormat->fromArray($intlNumberFormatElt);
  782. $this->addIntlNumberFormat($numberFormat);
  783. }
  784. $this->setMainCountryForCode($input['mainCountryForCode']);
  785. if (isset($input['leadingDigits'])) {
  786. $this->setLeadingDigits($input['leadingDigits']);
  787. }
  788. if (isset($input['mobileNumberPortableRegion'])) {
  789. $this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']);
  790. }
  791. return $this;
  792. }
  793. public function addNumberFormat(NumberFormat $value)
  794. {
  795. $this->numberFormat[] = $value;
  796. return $this;
  797. }
  798. public function addIntlNumberFormat(NumberFormat $value)
  799. {
  800. $this->intlNumberFormat[] = $value;
  801. return $this;
  802. }
  803. }