TimestampShape
extends Shape
in package
Represents a timestamp shape.
Table of Contents
Methods
- __construct() : mixed
- create() : mixed
- Get a concrete shape for the given definition.
- format() : int|float|string
- Formats a timestamp value for a service.
- formatAsString() : string
- Formats a timestamp value for a service as a string.
- getContextParam() : mixed
- Get a context param definition.
- getName() : string
- Get the name of the shape
- getType() : string
- Get the type of the shape
- offsetExists() : bool
- offsetGet() : mixed|null
- offsetSet() : void
- offsetUnset() : void
- toArray() : mixed
Methods
__construct()
public
__construct(array<string|int, mixed> $definition, ShapeMap $shapeMap) : mixed
Parameters
- $definition : array<string|int, mixed>
- $shapeMap : ShapeMap
create()
Get a concrete shape for the given definition.
public
static create(array<string|int, mixed> $definition, ShapeMap $shapeMap) : mixed
Parameters
- $definition : array<string|int, mixed>
- $shapeMap : ShapeMap
Tags
format()
Formats a timestamp value for a service.
public
static format(mixed $value, string $format) : int|float|string
Sub-second precision provided by the caller is preserved for the
iso8601 and unixTimestamp formats. rfc822 (HTTP-date) only
supports whole seconds, so fractional seconds are dropped.
Parameters
- $value : mixed
-
Value to format
- $format : string
-
Format used to serialize the value
Tags
Return values
int|float|stringformatAsString()
Formats a timestamp value for a service as a string.
public
static formatAsString(mixed $value, string $format) : string
Behaves like format(), except that a unixTimestamp value is
returned as a decimal string (e.g. "1704110400.123456"). Casting a
float to a string directly is subject to the precision ini setting
(14 significant digits by default), which would silently drop the
sub-second component of an epoch-seconds timestamp.
Parameters
- $value : mixed
-
Value to format
- $format : string
-
Format used to serialize the value
Tags
Return values
stringgetContextParam()
Get a context param definition.
public
getContextParam() : mixed
getName()
Get the name of the shape
public
getName() : string
Return values
stringgetType()
Get the type of the shape
public
getType() : string
Return values
stringoffsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed|null
Parameters
- $offset : mixed
Return values
mixed|nulloffsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
toArray()
public
toArray() : mixed