|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Services\Responses; |
|
6
|
|
|
|
|
7
|
|
|
use JMS\Serializer\Annotation AS JMS; |
|
8
|
|
|
|
|
9
|
|
|
final class Phone |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* Коды качества нормализации телефона. |
|
13
|
|
|
* |
|
14
|
|
|
* @see https://otpravka.pochta.ru/specification#/enums-clean-fio-phone-quality |
|
15
|
|
|
*/ |
|
16
|
|
|
public const QUALITY_UNDEF = 'UNDEF'; |
|
17
|
|
|
public const QUALITY_EMPTY = 'EMPTY'; |
|
18
|
|
|
public const QUALITY_GARBAGE = 'GARBAGE'; |
|
19
|
|
|
public const QUALITY_INCORRECT_DATA = 'INCORRECT_DATA'; |
|
20
|
|
|
public const QUALITY_FOREIGN = 'FOREIGN'; |
|
21
|
|
|
public const QUALITY_CODE_AMBI = 'CODE_AMBI'; |
|
22
|
|
|
public const QUALITY_GOOD = 'GOOD'; |
|
23
|
|
|
public const QUALITY_GOOD_CITY = 'GOOD_CITY'; |
|
24
|
|
|
public const QUALITY_GOOD_EXTRA_PHONE = 'GOOD_EXTRA_PHONE'; |
|
25
|
|
|
public const QUALITY_GOOD_REPLACED_CODE = 'GOOD_REPLACED_CODE'; |
|
26
|
|
|
public const QUALITY_GOOD_REPLACED_NUMBER = 'GOOD_REPLACED_NUMBER'; |
|
27
|
|
|
public const QUALITY_GOOD_REPLACED_CODE_NUMBER = 'GOOD_REPLACED_CODE_NUMBER'; |
|
28
|
|
|
public const QUALITY_GOOD_CITY_CONFLICT = 'GOOD_CITY_CONFLICT'; |
|
29
|
|
|
public const QUALITY_GOOD_REGION_CONFLICT = 'GOOD_REGION_CONFLICT'; |
|
30
|
|
|
public const QUALITY_CONFIRMED_MANUALLY = 'CONFIRMED_MANUALLY'; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @JMS\Type("string") |
|
34
|
|
|
* @var string |
|
35
|
|
|
*/ |
|
36
|
|
|
private $id; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @JMS\SerializedName("phone-country-code") |
|
40
|
|
|
* @JMS\Type("string") |
|
41
|
|
|
* @var string |
|
42
|
|
|
*/ |
|
43
|
|
|
private $countryCode; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @JMS\SerializedName("phone-city-code") |
|
47
|
|
|
* @JMS\Type("string") |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
private $cityCode; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @JMS\SerializedName("phone-number") |
|
54
|
|
|
* @JMS\Type("string") |
|
55
|
|
|
* @var string |
|
56
|
|
|
*/ |
|
57
|
|
|
private $number; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @JMS\SerializedName("phone-extension") |
|
61
|
|
|
* @JMS\Type("string") |
|
62
|
|
|
* @var string |
|
63
|
|
|
*/ |
|
64
|
|
|
private $extension; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @JMS\SerializedName("original-phone") |
|
68
|
|
|
* @JMS\Type("string") |
|
69
|
|
|
* @var string |
|
70
|
|
|
*/ |
|
71
|
|
|
private $originalPhone; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @JMS\SerializedName("quality-code") |
|
75
|
|
|
* @JMS\Type("string") |
|
76
|
|
|
* @var string |
|
77
|
|
|
*/ |
|
78
|
|
|
private $qualityCode; |
|
79
|
|
|
|
|
80
|
|
|
public function getId(): string |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->id; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getCountryCode(): string |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->countryCode; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function getCityCode(): string |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->cityCode; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function getNumber(): string |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->number; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function getExtension(): string |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->extension; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function getOriginalPhone(): string |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->originalPhone; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function isUseful(): bool |
|
111
|
|
|
{ |
|
112
|
|
|
return |
|
113
|
|
|
$this->qualityCode === self::QUALITY_CONFIRMED_MANUALLY |
|
114
|
|
|
|| |
|
115
|
|
|
\strpos($this->qualityCode, self::QUALITY_GOOD) === 0; |
|
116
|
|
|
} |
|
117
|
|
|
} |
|
118
|
|
|
|