Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
textnode.php
1
<?
2
namespace
Bitrix\UI\EntitySelector
;
3
4
class
TextNode
implements
\JsonSerializable
5
{
6
protected
?
string
$text
=
null
;
7
protected
?
string
$type
=
null
;
8
9
public
function
__construct
($options)
10
{
11
if
(is_array($options))
12
{
13
if
(isset($options[
'text'
]) && (is_string($options[
'text'
]) || is_int($options[
'text'
])))
14
{
15
$this->text = (string)$options[
'text'
];
16
}
17
18
if
(isset($options[
'type'
]) &&
TextNodeType::isValid
($options[
'type'
]))
19
{
20
$this->type = $options[
'type'
];
21
}
22
}
23
else
if
(is_string($options) || is_int($options))
24
{
25
$this->text = (string)$options;
26
}
27
}
28
29
public
static
function
isValidText
(
$text
): bool
30
{
31
return
is_string(
$text
) || is_int(
$text
) || is_array(
$text
);
32
}
33
34
public
function
getType
(): ?string
35
{
36
return
$this->type
;
37
}
38
39
public
function
getText
(): ?string
40
{
41
return
$this->text
;
42
}
43
44
public
function
isNullable
(): bool
45
{
46
return
$this->
getText
() ===
null
;
47
}
48
49
public
function
jsonSerialize
()
50
{
51
if
($this->
getType
() ===
null
)
52
{
53
return
$this->
getText
();
54
}
55
else
56
{
57
return
[
58
'text'
=> $this->
getText
(),
59
'type'
=> $this->
getType
()
60
];
61
}
62
}
63
}
Bitrix\UI\EntitySelector\TextNode
Definition
textnode.php:5
Bitrix\UI\EntitySelector\TextNode\getType
getType()
Definition
textnode.php:34
Bitrix\UI\EntitySelector\TextNode\getText
getText()
Definition
textnode.php:39
Bitrix\UI\EntitySelector\TextNode\isValidText
static isValidText($text)
Definition
textnode.php:29
Bitrix\UI\EntitySelector\TextNode\$type
string $type
Definition
textnode.php:7
Bitrix\UI\EntitySelector\TextNode\$text
string $text
Definition
textnode.php:6
Bitrix\UI\EntitySelector\TextNode\jsonSerialize
jsonSerialize()
Definition
textnode.php:49
Bitrix\UI\EntitySelector\TextNode\__construct
__construct($options)
Definition
textnode.php:9
Bitrix\UI\EntitySelector\TextNode\isNullable
isNullable()
Definition
textnode.php:44
Bitrix\UI\EntitySelector\TextNodeType\isValid
static isValid($type)
Definition
textnodetype.php:9
Bitrix\UI\EntitySelector
Definition
basefilter.php:2
modules
ui
lib
entityselector
textnode.php
Создано системой
1.10.0