1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Timestamp.php
См. документацию.
1
<?php
2
declare(strict_types=1);
3
4
namespace
Bitrix\Im\V2\Message\Text\BbCode;
5
6
use Bitrix\Im\V2\Message\Text\BbCode\Timestamp\DateFormat;
7
use Bitrix\Im\V2\Message\Text\OpenBbCode;
8
use Bitrix\Main\Application;
9
use Bitrix\Main\Type\Date;
10
use Bitrix\Main\Type\DateTime;
11
12
final
class
Timestamp
extends
OpenBbCode
13
{
14
private
Date
$date;
15
private
DateFormat
$formatCode;
16
17
private
function
__construct(
Date
$date,
DateFormat
$formatCode)
18
{
19
$this->date = $date;
20
$this->formatCode = $formatCode;
21
}
22
23
public
static
function
build
(
Date
$date,
DateFormat
$formatCode): self
24
{
25
return
new
self
($date, $formatCode);
26
}
27
28
public
function
toPlain
(): string
29
{
30
$format = $this->getFormat();
31
32
return
FormatDate
($format, $this->date);
33
}
34
35
public
static
function
getName
(): string
36
{
37
return
'TIMESTAMP'
;
38
}
39
40
protected
function
getValue
(): ?string
41
{
42
return
(
string
)$this->date->getTimestamp();
43
}
44
45
protected
function
getAdditionalParams
():
array
46
{
47
return
[
'FORMAT'
=> $this->formatCode->value];
48
}
49
50
private
function
getFormat(): string
51
{
52
$culture
=
Application::getInstance
()->getContext()->getCulture();
53
if
(
$culture
===
null
)
54
{
55
return
''
;
56
}
57
58
$format =
$culture
->get($this->formatCode->value);
59
60
if
($this->formatCode === DateFormat::FormatDatetime || $this->formatCode === DateFormat::FormatDate)
61
{
62
return
DateTime::convertFormatToPhp($format);
63
}
64
65
return
$format;
66
}
67
}
Bitrix\Im\V2\Message\Text\BbCode\Timestamp\getName
static getName()
Определения
Timestamp.php:35
Bitrix\Im\V2\Message\Text\BbCode\Timestamp\build
static build(Date $date, DateFormat $formatCode)
Определения
Timestamp.php:23
Bitrix\Im\V2\Message\Text\BbCode\Timestamp\DateFormat
DateFormat
Определения
DateFormat.php:10
Bitrix\Im\V2\Message\Text\BbCode\Timestamp\getAdditionalParams
getAdditionalParams()
Определения
Timestamp.php:45
Bitrix\Im\V2\Message\Text\BbCode\Timestamp\toPlain
toPlain()
Определения
Timestamp.php:28
Bitrix\Im\V2\Message\Text\BbCode\Timestamp\getValue
getValue()
Определения
Timestamp.php:40
Bitrix\Im\V2\Message\Text\OpenBbCode
Определения
OpenBbCode.php:7
Bitrix\Main\DI\ServiceLocator\getInstance
static getInstance()
Определения
servicelocator.php:33
Bitrix\Main\Type\Date
Определения
date.php:9
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$culture
$culture
Определения
include.php:61
FormatDate
FormatDate($format="", $timestamp=false, $now=false, ?string $languageId=null)
Определения
tools.php:871
Bitrix\Im\V2\Message\Text\BbCode\Timestamp
Определения
DateFormat.php:4
bitrix
modules
im
lib
V2
Message
Text
BbCode
Timestamp.php
Создано системой
1.14.0