NilUlid
extends Ulid
in package
A ULID is lexicographically sortable and contains a 48-bit timestamp and 80-bit of crypto-random entropy.
Table of Contents
Constants
- NIL = '00000000000000000000000000'
Properties
- $uid : mixed
- The identifier in its canonic representation.
- $rand : array<string|int, mixed>
- $time : string
Methods
- __construct() : mixed
- __toString() : string
- compare() : int
- equals() : bool
- Returns whether the argument is an AbstractUid and contains the same value as the current instance.
- fromBase32() : static
- fromBase58() : static
- fromBinary() : static
- fromRfc4122() : static
- fromString() : static
- Creates an AbstractUid from an identifier represented in any of the supported formats.
- generate() : string
- getDateTime() : DateTimeImmutable
- isValid() : bool
- Whether the passed value is valid for the constructor of the current class.
- jsonSerialize() : string
- toBase32() : string
- Returns the identifier as a base32 case insensitive string.
- toBase58() : string
- Returns the identifier as a base58 case sensitive string.
- toBinary() : string
- Returns the identifier as a raw binary string.
- toRfc4122() : string
- Returns the identifier as a RFC4122 case insensitive string.
Constants
NIL
protected
mixed
NIL
= '00000000000000000000000000'
Properties
$uid
The identifier in its canonic representation.
protected
mixed
$uid
$rand
private
static array<string|int, mixed>
$rand
= []
$time
private
static string
$time
= ''
Methods
__construct()
public
__construct() : mixed
__toString()
public
__toString() : string
Return values
stringcompare()
public
compare(self $other) : int
Parameters
- $other : self
Return values
intequals()
Returns whether the argument is an AbstractUid and contains the same value as the current instance.
public
equals(mixed $other) : bool
Parameters
- $other : mixed
Return values
boolfromBase32()
public
static fromBase32(string $uid) : static
Parameters
- $uid : string
Tags
Return values
staticfromBase58()
public
static fromBase58(string $uid) : static
Parameters
- $uid : string
Tags
Return values
staticfromBinary()
public
static fromBinary(string $uid) : static
Parameters
- $uid : string
Tags
Return values
staticfromRfc4122()
public
static fromRfc4122(string $uid) : static
Parameters
- $uid : string
Tags
Return values
staticfromString()
Creates an AbstractUid from an identifier represented in any of the supported formats.
public
abstract static fromString(string $uid) : static
Parameters
- $uid : string
Tags
Return values
staticgenerate()
public
static generate([DateTimeInterface $time = null ]) : string
Parameters
- $time : DateTimeInterface = null
Return values
stringgetDateTime()
public
getDateTime() : DateTimeImmutable
Return values
DateTimeImmutableisValid()
Whether the passed value is valid for the constructor of the current class.
public
abstract static isValid(string $uid) : bool
Parameters
- $uid : string
Return values
booljsonSerialize()
public
jsonSerialize() : string
Return values
stringtoBase32()
Returns the identifier as a base32 case insensitive string.
public
toBase32() : string
Return values
stringtoBase58()
Returns the identifier as a base58 case sensitive string.
public
toBase58() : string
Return values
stringtoBinary()
Returns the identifier as a raw binary string.
public
abstract toBinary() : string
Return values
stringtoRfc4122()
Returns the identifier as a RFC4122 case insensitive string.
public
toRfc4122() : string