This repository has been archived by the owner on Aug 21, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
/
PhoneNumber.php
199 lines (158 loc) · 4.03 KB
/
PhoneNumber.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
namespace com\google\i18n\phonenumbers;
class PhoneNumber {
/**
* @var int
*/
private $countryCode = NULL;
public function hasCountryCode() {
return isset($this->countryCode);
}
public function getCountryCode() {
return $this->countryCode;
}
public function setCountryCode($value) {
$this->countryCode = $value;
return $this;
}
public function clearCountryCode() {
$this->countryCode = NULL;
return $this;
}
/**
* @var int
*/
private $nationalNumber = NULL;
public function hasNationalNumber() {
return isset($this->nationalNumber);
}
public function getNationalNumber() {
return $this->nationalNumber;
}
public function setNationalNumber($value) {
$this->nationalNumber = $value;
return $this;
}
public function clearNationalNumber() {
$this->nationalNumber = NULL;
return $this;
}
private $extension = NULL;
public function hasExtension() {
return isset($this->extension);
}
public function getExtension() {
return $this->extension;
}
public function setExtension($value) {
$this->extension = $value;
return $this;
}
public function clearExtension() {
$this->extension = NULL;
return $this;
}
/**
* @var boolean
*/
private $italianLeadingZero = NULL;
public function hasItalianLeadingZero() {
return isset($this->italianLeadingZero);
}
public function isItalianLeadingZero() {
return $this->italianLeadingZero;
}
public function setItalianLeadingZero($value) {
$this->italianLeadingZero = $value;
return $this;
}
public function clearItalianLeadingZero() {
$this->italianLeadingZero = NULL;
return $this;
}
private $rawInput = NULL;
public function hasRawInput() {
return isset($this->rawInput);
}
public function getRawInput() {
return $this->rawInput;
}
public function setRawInput($value) {
$this->rawInput = $value;
return $this;
}
public function clearRawInput() {
$this->rawInput = NULL;
return $this;
}
private $countryCodeSource = NULL;
public function hasCountryCodeSource() {
return isset($this->countryCodeSource);
}
public function getCountryCodeSource() {
return $this->countryCodeSource;
}
public function setCountryCodeSource($value) {
$this->countryCodeSource = $value;
return $this;
}
public function clearCountryCodeSource() {
$this->countryCodeSource = NULL;
return $this;
}
private $preferredDomesticCarrierCode = NULL;
public function hasPreferredDomesticCarrierCode() {
return isset($this->preferredDomesticCarrierCode);
}
public function getPreferredDomesticCarrierCode() {
return $this->preferredDomesticCarrierCode;
}
public function setPreferredDomesticCarrierCode($value) {
$this->preferredDomesticCarrierCode = $value;
return $this;
}
public function clearPreferredDomesticCarrierCode() {
$this->preferredDomesticCarrierCode = NULL;
return $this;
}
public function clear() {
$this->clearCountryCode();
$this->clearNationalNumber();
$this->clearExtension();
$this->clearItalianLeadingZero();
$this->clearRawInput();
$this->clearCountryCodeSource();
$this->clearPreferredDomesticCarrierCode();
return $this;
}
public function mergeFrom(PhoneNumber $other) {
if ($other->hasCountryCode()) {
$this->setCountryCode($other->getCountryCode());
}
if ($other->hasNationalNumber()) {
$this->setNationalNumber($other->getNationalNumber());
}
if ($other->hasExtension()) {
$this->setExtension($other->getExtension());
}
if ($other->hasItalianLeadingZero()) {
$this->setItalianLeadingZero($other->isItalianLeadingZero());
}
if ($other->hasRawInput()) {
$this->setRawInput($other->getRawInput());
}
if ($other->hasCountryCodeSource()) {
$this->setCountryCodeSource($other->getCountryCodeSource());
}
if ($other->hasPreferredDomesticCarrierCode()) {
$this->setPreferredDomesticCarrierCode($other->getPreferredDomesticCarrierCode());
}
return $this;
}
}
class CountryCodeSource {
const FROM_NUMBER_WITH_PLUS_SIGN = 0;
const FROM_NUMBER_WITH_IDD = 1;
const FROM_NUMBER_WITHOUT_PLUS_SIGN = 2;
const FROM_DEFAULT_COUNTRY = 3;
}