Decimal
in package
implements
NumberInterface
A value object representing a decimal
This class exists for type-safety purposes, to ensure that decimals returned from ramsey/uuid methods as strings are truly decimals and not some other kind of string.
To support values as true decimals and not as floats or doubles, we store the decimals as strings.
Tags
Interfaces, Classes, Traits and Enums
- NumberInterface
- NumberInterface ensures consistency in numeric values returned by ramsey/uuid
Table of Contents
- $isNegative : bool
- $value : string
- __construct() : mixed
- __serialize() : array<string|int, mixed>
- __toString() : string
- __unserialize() : void
- isNegative() : bool
- Returns true if this number is less than zero
- jsonSerialize() : string
- serialize() : string
- toString() : string
- unserialize() : void
- Constructs the object from a serialized string representation
Properties
$isNegative
private
bool
$isNegative
= false
$value
private
string
$value
Methods
__construct()
public
__construct(mixed $value) : mixed
Parameters
- $value : mixed
-
The decimal value to store
Return values
mixed —__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —__toString()
public
__toString() : string
Return values
string —__unserialize()
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Return values
void —isNegative()
Returns true if this number is less than zero
public
isNegative() : bool
Return values
bool —jsonSerialize()
public
jsonSerialize() : string
Return values
string —serialize()
public
serialize() : string
Return values
string —toString()
public
toString() : string
Return values
string —unserialize()
Constructs the object from a serialized string representation
public
unserialize(string $serialized) : void
Parameters
- $serialized : string
-
The serialized string representation of the object