final class ObjectId implements Type, ObjectIdInterface, Serializable, JsonSerializable (View source)

Class ObjectId

Methods

__construct(string|null $id = null)

Construct a new ObjectId

string
__toString()

Returns the hexadecimal representation of this ObjectId

static 
__set_state(array $properties)

No description

int
getTimestamp()

Returns the timestamp component of this ObjectId

mixed
jsonSerialize()

Returns a representation that can be converted to JSON

string|null
serialize()

Serialize an ObjectId

void
unserialize(string $data)

Unserialize an ObjectId

Details

final __construct(string|null $id = null)

Construct a new ObjectId

Parameters

string|null $id

A 24-character hexadecimal string. If not provided, the driver will generate an ObjectId.

Exceptions

InvalidArgumentException

final string __toString()

Returns the hexadecimal representation of this ObjectId

Return Value

string

Returns the hexadecimal representation of this ObjectId

static __set_state(array $properties)

No description

Parameters

array $properties

final int getTimestamp()

Since: 1.2.0

Returns the timestamp component of this ObjectId

Return Value

int

Returns the timestamp component of this ObjectIdInterface.

final mixed jsonSerialize()

Since: 1.2.0

Returns a representation that can be converted to JSON

Return Value

mixed

data which can be serialized by json_encode, which is a value of any type other than a resource.

final string|null serialize()

Since: 1.2.0

Serialize an ObjectId

Return Value

string|null

The string representation of the object or null

final void unserialize(string $data)

Since: 1.2.0

Unserialize an ObjectId

Parameters

string $data

The string representation of the object.

Return Value

void