PHP Класс MongoId

Наследование: implements Serializable, implements Alcaeus\MongoDbAdapter\TypeInterface, implements JsonSerializable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $id = null ) Creates a new id
__get ( string $name ) : null | string
__isset ( string $name ) : boolean
__set ( string $name, mixed $value )
__set_state ( array $props ) : MongoId (PECL mongo >= 1.0.8) Create a dummy MongoId
__toString ( ) : string Returns a hexidecimal representation of this id
__unset ( string $name )
getHostname ( ) : string Gets the hostname being used for this machine's ids
getInc ( ) : integer Gets the incremented value to create this id
getPID ( ) : integer (PECL mongo >= 1.0.11) Gets the process ID
getTimestamp ( ) : integer (PECL mongo >= 1.0.1) Gets the number of seconds since the epoch that this id was created
isValid ( mixed $value ) : boolean Check if a value is a valid ObjectId
jsonSerialize ( ) : stdClass
serialize ( ) : string
toBSONType ( ) : MongoDB\BSON\ObjectID Converts this MongoId to the new BSON ObjectID type
unserialize ( string $serialized )

Приватные методы

Метод Описание
createObjectID ( $id )

Описание методов

__construct() публичный Метод

Creates a new id
public __construct ( string $id = null )
$id string [optional] A string to use as the id. Must be 24 hexidecimal characters. If an invalid string is passed to this constructor, the constructor will ignore it and create a new id value.

__get() публичный Метод

public __get ( string $name ) : null | string
$name string
Результат null | string

__isset() публичный Метод

public __isset ( string $name ) : boolean
$name string
Результат boolean

__set() публичный Метод

public __set ( string $name, mixed $value )
$name string
$value mixed

__set_state() публичный статический Метод

(PECL mongo >= 1.0.8) Create a dummy MongoId
public static __set_state ( array $props ) : MongoId
$props array

Theoretically, an array of properties used to create the new id. However, as MongoId instances have no properties, this is not used.

Результат MongoId A new id with the value "000000000000000000000000".

__toString() публичный Метод

Returns a hexidecimal representation of this id
public __toString ( ) : string
Результат string

__unset() публичный Метод

public __unset ( string $name )
$name string

getHostname() публичный статический Метод

Gets the hostname being used for this machine's ids
public static getHostname ( ) : string
Результат string

getInc() публичный Метод

Gets the incremented value to create this id
public getInc ( ) : integer
Результат integer Returns the incremented value used to create this MongoId.

getPID() публичный Метод

(PECL mongo >= 1.0.11) Gets the process ID
public getPID ( ) : integer
Результат integer Returns the PID of the MongoId.

getTimestamp() публичный Метод

(PECL mongo >= 1.0.1) Gets the number of seconds since the epoch that this id was created
public getTimestamp ( ) : integer
Результат integer

isValid() публичный статический Метод

Check if a value is a valid ObjectId
public static isValid ( mixed $value ) : boolean
$value mixed The value to check for validity.
Результат boolean

jsonSerialize() публичный Метод

public jsonSerialize ( ) : stdClass
Результат stdClass

serialize() публичный Метод

public serialize ( ) : string
Результат string

toBSONType() публичный Метод

Converts this MongoId to the new BSON ObjectID type
public toBSONType ( ) : MongoDB\BSON\ObjectID
Результат MongoDB\BSON\ObjectID

unserialize() публичный Метод

public unserialize ( string $serialized )
$serialized string