Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7439388
DateTimeImmutable.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DateTimeImmutable.php
View Options
<?php
declare
(
strict_types
=
1
);
/*
* This file is part of the Monolog package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Monolog
;
use
DateTimeZone
;
/**
* Overrides default json encoding of date time objects
*
* @author Menno Holtkamp
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class
DateTimeImmutable
extends
\DateTimeImmutable
implements
\JsonSerializable
{
/**
* @var bool
*/
private
$useMicroseconds
;
public
function
__construct
(
bool
$useMicroseconds
,
?
DateTimeZone
$timezone
=
null
)
{
$this
->
useMicroseconds
=
$useMicroseconds
;
// if you like to use a custom time to pass to Logger::addRecord directly,
// call modify() or setTimestamp() on this instance to change the date after creating it
parent
::
__construct
(
'now'
,
$timezone
);
}
public
function
jsonSerialize
():
string
{
if
(
$this
->
useMicroseconds
)
{
return
$this
->
format
(
'Y-m-d
\T
H:i:s.uP'
);
}
return
$this
->
format
(
'Y-m-d
\T
H:i:sP'
);
}
public
function
__toString
():
string
{
return
$this
->
jsonSerialize
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 15:02 (5 d, 8 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
56/44/44d17e751976143aa3555809d6d1
Default Alt Text
DateTimeImmutable.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment