Skip to content

Integer

A value object representing an integer

This class exists for type-safety purposes, to ensure that integers returned from ramsey/uuid methods as strings are truly integers and not some other kind of string.

To support large integers beyond PHP_INT_MAX and PHP_INT_MIN on both 64-bit and 32-bit systems, we store the integers as strings.

  • Full name: \Ramsey\Uuid\Type\Integer
  • 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}

prepareValue

private prepareValue(float|int|string $value): numeric-string

Parameters:

Parameter Type Description
$value float|int|string


Automatically generated on 2025-03-18