PHP Class Mongolid\Serializer\Type\UTCDateTime

Inheritance: implements Mongolid\Serializer\SerializableTypeInterface, implements JsonSerializabl\JsonSerializable
Datei anzeigen Open project: leroy-merlin-br/mongolid Class Usage Examples

Protected Properties

Property Type Description
$mongoDate MongoDB\BSON\UTCDateTime
$timestamp integer

Public Methods

Method Description
__call ( string $method, array $args = [] ) : mixed A wrapper to use this class as MongoUTCDateTime.
__construct ( integer | MongoDB\BSON\UTCDateTime | null $datetime = null ) Constructor.
__toString ( ) : string Allows casting to string utilizing drivers UTCDateTime implementation.
convert ( ) : MongoDB\BSON\UTCDateTime
jsonSerialize ( ) : string
serialize ( ) : string
toLocalDateTime ( ) : DateTime Retrieve a DateTime object with proper timezone set.
unserialize ( mixed $data ) : void

Protected Methods

Method Description
init ( integer | MongoDB\BSON\UTCDateTime | null $datetime ) : boolean Initializes timestamp and mongoDate variables.

Method Details

__call() public method

A wrapper to use this class as MongoUTCDateTime.
public __call ( string $method, array $args = [] ) : mixed
$method string Method of MongoUTCDateTime to call.
$args array Arguments to pass.
return mixed

__construct() public method

Constructor.
public __construct ( integer | MongoDB\BSON\UTCDateTime | null $datetime = null )
$datetime integer | MongoDB\BSON\UTCDateTime | null MongoUTCDateTime or Timestamp to wrap. If it was null, uses current timestamp.

__toString() public method

Allows casting to string utilizing drivers UTCDateTime implementation.
public __toString ( ) : string
return string Returns the string representation of this UTCDateTime.

convert() public method

public convert ( ) : MongoDB\BSON\UTCDateTime
return MongoDB\BSON\UTCDateTime

init() protected method

Initializes timestamp and mongoDate variables.
protected init ( integer | MongoDB\BSON\UTCDateTime | null $datetime ) : boolean
$datetime integer | MongoDB\BSON\UTCDateTime | null MongoUTCDateTime or Timestamp to wrap. If it was null, uses current timestamp.
return boolean

jsonSerialize() public method

public jsonSerialize ( ) : string
return string

serialize() public method

public serialize ( ) : string
return string

toLocalDateTime() public method

Retrieve a DateTime object with proper timezone set.
public toLocalDateTime ( ) : DateTime
return DateTime

unserialize() public method

public unserialize ( mixed $data ) : void
$data mixed Serialized string to parse.
return void

Property Details

$mongoDate protected_oe property

protected UTCDateTime,MongoDB\BSON $mongoDate
return MongoDB\BSON\UTCDateTime

$timestamp protected_oe property

protected int $timestamp
return integer