PHP Class Mongolid\Serializer\Type\UTCDateTime

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

Protected Properties

Свойство Type Description
$mongoDate MongoDB\BSON\UTCDateTime
$timestamp integer

Méthodes publiques

Méthode 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

Méthodes protégées

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

Method Details

__call() public méthode

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.
Résultat mixed

__construct() public méthode

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 méthode

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

convert() public méthode

public convert ( ) : MongoDB\BSON\UTCDateTime
Résultat MongoDB\BSON\UTCDateTime

init() protected méthode

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.
Résultat boolean

jsonSerialize() public méthode

public jsonSerialize ( ) : string
Résultat string

serialize() public méthode

public serialize ( ) : string
Résultat string

toLocalDateTime() public méthode

Retrieve a DateTime object with proper timezone set.
public toLocalDateTime ( ) : DateTime
Résultat DateTime

unserialize() public méthode

public unserialize ( mixed $data ) : void
$data mixed Serialized string to parse.
Résultat void

Property Details

$mongoDate protected_oe property

protected UTCDateTime,MongoDB\BSON $mongoDate
Résultat MongoDB\BSON\UTCDateTime

$timestamp protected_oe property

protected int $timestamp
Résultat integer