mediatekformation

DateIntervalNormalizer
in package
implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface

Normalizes an instance of {@see \DateInterval} to an interval string.

Denormalizes an interval string to an instance of DateInterval.

Tags
author

Jérôme Parmentier jerome@prmntr.me

Interfaces, Classes, Traits and Enums

NormalizerInterface
DenormalizerInterface
CacheableSupportsMethodInterface
Marker interface for normalizers and denormalizers that use only the type and the format in their supports*() methods.

Table of Contents

FORMAT_KEY  = 'dateinterval_format'
$defaultContext  : mixed
__construct()  : mixed
denormalize()  : DateInterval
Denormalizes data back into an object of the given class.
hasCacheableSupportsMethod()  : bool
normalize()  : string
Normalizes an object into a set of arrays/scalars.
supportsDenormalization()  : bool
Checks whether the given class is supported for denormalization by this normalizer.
supportsNormalization()  : bool
Checks whether the given class is supported for normalization by this normalizer.
isISO8601()  : bool

Constants

Properties

Methods

__construct()

public __construct([array<string|int, mixed> $defaultContext = [] ]) : mixed
Parameters
$defaultContext : array<string|int, mixed> = []
Return values
mixed

denormalize()

Denormalizes data back into an object of the given class.

public denormalize(mixed $data, mixed $type[, mixed $format = null ][, array<string|int, mixed> $context = [] ]) : DateInterval
Parameters
$data : mixed

Data to restore

$type : mixed

The expected class to instantiate

$format : mixed = null

Format the given data was extracted from

$context : array<string|int, mixed> = []

Options available to the denormalizer

Tags
throws
InvalidArgumentException
throws
UnexpectedValueException
Return values
DateInterval

normalize()

Normalizes an object into a set of arrays/scalars.

public normalize(mixed $object[, mixed $format = null ][, array<string|int, mixed> $context = [] ]) : string
Parameters
$object : mixed

Object to normalize

$format : mixed = null

Format the normalization result will be encoded as

$context : array<string|int, mixed> = []

Context options for the normalizer

Tags
throws
InvalidArgumentException
Return values
string

supportsDenormalization()

Checks whether the given class is supported for denormalization by this normalizer.

public supportsDenormalization(mixed $data, mixed $type[, mixed $format = null ]) : bool
Parameters
$data : mixed

Data to denormalize from

$type : mixed

The class to which the data should be denormalized

$format : mixed = null

The format being deserialized from

Return values
bool

supportsNormalization()

Checks whether the given class is supported for normalization by this normalizer.

public supportsNormalization(mixed $data[, mixed $format = null ]) : bool
Parameters
$data : mixed

Data to normalize

$format : mixed = null

The format being (de-)serialized from or into

Return values
bool

isISO8601()

private isISO8601(string $string) : bool
Parameters
$string : string
Return values
bool

Search results