Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
phonenumber.php
1<?php
2
4
6{
7 protected $rawNumber;
8 protected $country;
9
10 protected $valid = false;
11 protected $countryCode;
12 protected $nationalNumber;
13 protected $nationalPrefix;
14 protected $hasPlus = false;
15 protected $numberType;
16 protected $extension = '';
18
19 protected $international = false;
20
21 public function format($formatType = '', $forceNationalPrefix = false)
22 {
23 if($this->valid)
24 {
25 if($formatType == '')
26 {
27 return Formatter::formatOriginal($this);
28 }
29 else
30 {
31 return Formatter::format($this, $formatType, $forceNationalPrefix);
32 }
33 }
34 else
35 {
36 if($formatType == '' && ShortNumberFormatter::isApplicable($this))
37 {
38 return ShortNumberFormatter::format($this);
39 }
40 else
41 {
42 return $this->rawNumber;
43 }
44 }
45 }
46
50 public function getRawNumber()
51 {
52 return $this->rawNumber;
53 }
54
58 public function setRawNumber($rawNumber)
59 {
60 $this->rawNumber = $rawNumber;
61 }
62
66 public function getCountry()
67 {
68 return $this->country;
69 }
70
74 public function setCountry($country)
75 {
76 $this->country = $country;
77 }
78
82 public function getNationalNumber()
83 {
84 return $this->nationalNumber;
85 }
86
90 public function setNationalNumber($nationalNumber)
91 {
92 $this->nationalNumber = $nationalNumber;
93 }
94
98 public function getNumberType()
99 {
100 return $this->numberType;
101 }
102
106 public function setNumberType($numberType)
107 {
108 $this->numberType = $numberType;
109 }
110
114 public function isValid()
115 {
116 return $this->valid;
117 }
118
122 public function setValid($valid)
123 {
124 $this->valid = $valid;
125 }
126
130 public function setCountryCode($countryCode)
131 {
132 $this->countryCode = $countryCode;
133 }
134
135 public function getCountryCode()
136 {
137 return $this->countryCode;
138 }
139
140 public function hasExtension()
141 {
142 return $this->extension != '';
143 }
144
148 public function getExtension()
149 {
150 return $this->extension;
151 }
152
156 public function setExtension($extension)
157 {
158 $this->extension = $extension;
159 }
160
164 public function getExtensionSeparator()
165 {
166 return $this->extensionSeparator;
167 }
168
172 public function setExtensionSeparator($extensionSeparator)
173 {
174 $this->extensionSeparator = $extensionSeparator;
175 }
176
180 public function isInternational()
181 {
182 return $this->international;
183 }
184
188 public function setInternational($international)
189 {
190 $this->international = $international;
191 }
192
196 public function getNationalPrefix()
197 {
198 return $this->nationalPrefix;
199 }
200
204 public function setNationalPrefix($nationalPrefix)
205 {
206 $this->nationalPrefix = $nationalPrefix;
207 }
208
212 public function hasPlus()
213 {
214 return $this->hasPlus;
215 }
216
220 public function setHasPlus($hasPlus)
221 {
222 $this->hasPlus = $hasPlus;
223 }
224}
static formatOriginal(PhoneNumber $number)
Definition formatter.php:58
static format(PhoneNumber $number, $formatType, $forceNationalPrefix=false)
Definition formatter.php:7
format($formatType='', $forceNationalPrefix=false)
setExtensionSeparator($extensionSeparator)
static isApplicable(PhoneNumber $phoneNumber)