Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
possiblelengthfield.php
1
<?php
2
3
namespace
Bitrix\Main\PhoneNumber\Tools
;
4
5
use
Bitrix\Main\SystemException
;
6
7
class
PossibleLengthField
extends
XmlField
8
{
9
public
function
decodeValue
($value)
10
{
11
return
static::parsePossibleLength($value);
12
}
13
19
public
static
function
parsePossibleLength
($possibleLength)
20
{
21
$result = array();
22
$tokens = explode(
','
, $possibleLength);
23
foreach
($tokens as $token)
24
{
25
if
(preg_match(
'/^\d+$/'
, $token))
26
{
27
$result[] = (int)$token;
28
}
29
else
if
(preg_match(
'/^\[(\d+)-(\d+)\]$/'
, $token, $matches))
30
{
31
$start = $matches[1];
32
$end = $matches[2];
33
$result = array_merge($result, range($start, $end));
34
}
35
else
36
{
37
throw
new
SystemException
(
"Unrecognized token: "
, $token);
38
}
39
}
40
return
$result;
41
}
42
43
}
Bitrix\Main\PhoneNumber\Tools\PossibleLengthField
Definition
possiblelengthfield.php:8
Bitrix\Main\PhoneNumber\Tools\PossibleLengthField\parsePossibleLength
static parsePossibleLength($possibleLength)
Definition
possiblelengthfield.php:19
Bitrix\Main\PhoneNumber\Tools\PossibleLengthField\decodeValue
decodeValue($value)
Definition
possiblelengthfield.php:9
Bitrix\Main\PhoneNumber\Tools\XmlField
Definition
xmlfield.php:6
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Main\PhoneNumber\Tools
Definition
boolfield.php:3
modules
main
lib
phonenumber
tools
possiblelengthfield.php
Создано системой
1.10.0