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