Files
mrbs-equbao-2026/web/lib/MRBS/Intl/IntlDateFormatterFactory.php
T
人事系统开发 48092cab42
Docker image / push (push) Canceled after 0s
MRBS 1.12.2 等保2.0二级整改完整提交
包含:登录失败锁定、90天密码有效期、30分钟会话超时、
强制改密、登录审计日志、屏幕水印、企业背景图、
备案信息固定底部、favicon、登录页JS修复等全部改动
2026-09-08 21:19:47 +08:00

36 lines
1.2 KiB
PHP

<?php
// Note that we cannot use strict types here as some early versions of PHP (eg 7.2.34) throw
// a TypeError if null is passed as the sixth parameter to \IntlDateFormatter::_construct(),
// despite the signature on the manual page.
// declare(strict_types=1);
namespace MRBS\Intl;
// A factory class for creating either an instance of \IntlDateFormatter or \MRBS\Intl\IntlDateFormatter,
// depending on the setting of the $force_strftime config variable.
class IntlDateFormatterFactory
{
public static function create(
?string $locale,
int $dateType = \IntlDateFormatter::FULL,
int $timeType = \IntlDateFormatter::FULL,
$timezone = null,
$calendar = null,
?string $pattern = null)
{
global $force_strftime;
if ($force_strftime)
{
// This will return an instance of the emulation
return new IntlDateFormatter($locale, $dateType, $timeType, $timezone, $calendar, $pattern);
}
else
{
// This will return an instance of the standard PHP class if the 'intl' extension is loaded,
// otherwise an instance of the emulation
return new \IntlDateFormatter($locale, $dateType, $timeType, $timezone, $calendar, $pattern);
}
}
}