PHP Class MongoId

Inheritance: implements Serializable, implements Alcaeus\MongoDbAdapter\TypeInterface, implements JsonSerializable
Afficher le fichier Open project: alcaeus/mongo-php-adapter Class Usage Examples

Méthodes publiques

Méthode Description
__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 )

Private Methods

Méthode Description
createObjectID ( $id )

Method Details

__construct() public méthode

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

public __get ( string $name ) : null | string
$name string
Résultat null | string

__isset() public méthode

public __isset ( string $name ) : boolean
$name string
Résultat boolean

__set() public méthode

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

__set_state() public static méthode

(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.

Résultat MongoId A new id with the value "000000000000000000000000".

__toString() public méthode

Returns a hexidecimal representation of this id
public __toString ( ) : string
Résultat string

__unset() public méthode

public __unset ( string $name )
$name string

getHostname() public static méthode

Gets the hostname being used for this machine's ids
public static getHostname ( ) : string
Résultat string

getInc() public méthode

Gets the incremented value to create this id
public getInc ( ) : integer
Résultat integer Returns the incremented value used to create this MongoId.

getPID() public méthode

(PECL mongo >= 1.0.11) Gets the process ID
public getPID ( ) : integer
Résultat integer Returns the PID of the MongoId.

getTimestamp() public méthode

(PECL mongo >= 1.0.1) Gets the number of seconds since the epoch that this id was created
public getTimestamp ( ) : integer
Résultat integer

isValid() public static méthode

Check if a value is a valid ObjectId
public static isValid ( mixed $value ) : boolean
$value mixed The value to check for validity.
Résultat boolean

jsonSerialize() public méthode

public jsonSerialize ( ) : stdClass
Résultat stdClass

serialize() public méthode

public serialize ( ) : string
Résultat string

toBSONType() public méthode

Converts this MongoId to the new BSON ObjectID type
public toBSONType ( ) : MongoDB\BSON\ObjectID
Résultat MongoDB\BSON\ObjectID

unserialize() public méthode

public unserialize ( string $serialized )
$serialized string