Skip to content

Decimal

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.

  • Full name: \Ramsey\Uuid\Type\Decimal
  • This class is marked as final and can't be subclassed
  • This class implements: \Ramsey\Uuid\Type\NumberInterface
  • This class is a Final class

Properties

value

private string $value

isNegative

private bool $isNegative

Methods

__construct

public __construct(float|int|string|self $value): mixed

Parameters:

Parameter Type Description
$value float|int|string|self

isNegative

Returns true if this number is less than zero

public isNegative(): bool

toString

public toString(): string

__toString

public __toString(): string

jsonSerialize

public jsonSerialize(): string

serialize

public serialize(): string

__serialize

public __serialize(): array{string: string}

unserialize

Constructs the object from a serialized string representation

public unserialize(string $data): void

Parameters:

Parameter Type Description
$data string The serialized string representation of the object

__unserialize

public __unserialize(array{string?: string} $data): void

Parameters:

Parameter Type Description
$data array{string?: string}


Automatically generated on 2025-03-18