Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
DateTime.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Param
;
4
5
use
Bitrix\Im\V2\Message\Param
;
6
use
Bitrix\Main
;
7
8
class
DateTime
extends
Param
9
{
14
public
function
setValue
(
$value
): self
15
{
16
if
(
$value
instanceof Main\
Type
\
DateTime
)
17
{
18
$this->value =
$value
;
19
}
20
elseif (
$value
instanceof \
DateTime
)
21
{
22
$this->value = Main\Type\DateTime::createFromPhp(
$value
);
23
}
24
else
25
{
26
$this->value = Main\Type\DateTime::createFromTimestamp((
int
)
$value
);
27
}
28
29
return
$this;
30
}
31
35
public
function
getValue
(): ?Main\
Type
\
DateTime
36
{
37
if
(!empty($this->value))
38
{
39
if
($this->value instanceof Main\
Type
\
DateTime
)
40
{
41
return
$this->value
;
42
}
43
else
44
{
45
return
Main\Type\DateTime::createFromTimestamp((
int
)$this->value);
46
}
47
}
48
49
return
null
;
50
}
51
55
public
function
toRestFormat
(): ?string
56
{
57
if
($this->
getValue
() instanceof Main\
Type
\
DateTime
)
58
{
59
return
$this->
getValue
()->format(
'c'
);
60
}
61
62
return
null
;
63
}
64
69
public
function
saveValueFilter
(
$value
)
70
{
71
if
(
$value
instanceof Main\
Type
\
DateTime
)
72
{
73
return
$value
->getTimestamp();
74
}
75
76
return
$value
;
77
}
78
83
public
function
loadValueFilter
(
$value
)
84
{
85
if
(!(
$value
instanceof Main\
Type
\
DateTime
))
86
{
87
return
Main\Type\DateTime::createFromTimestamp((
int
)
$value
);
88
}
89
90
return
$value
;
91
}
92
}
Bitrix\Im\V2\Message\Param\DateTime
Definition
DateTime.php:9
Bitrix\Im\V2\Message\Param\DateTime\setValue
setValue($value)
Definition
DateTime.php:14
Bitrix\Im\V2\Message\Param\DateTime\loadValueFilter
loadValueFilter($value)
Definition
DateTime.php:83
Bitrix\Im\V2\Message\Param\DateTime\getValue
getValue()
Definition
DateTime.php:35
Bitrix\Im\V2\Message\Param\DateTime\saveValueFilter
saveValueFilter($value)
Definition
DateTime.php:69
Bitrix\Im\V2\Message\Param\DateTime\toRestFormat
toRestFormat()
Definition
DateTime.php:55
Bitrix\Im\V2\Message\Param
Definition
Param.php:19
Bitrix\Im\V2\Message\Param\$value
$value
Definition
Param.php:45
Bitrix\Im\V2\Message\Param
Definition
Attach.php:3
Bitrix\Main\Type
Definition
collection.php:2
Bitrix\Main
modules
im
lib
V2
Message
Param
DateTime.php
Создано системой
1.10.0