mediatekformation

WeekToArrayTransformer
in package
implements DataTransformerInterface

Transforms between an ISO 8601 week date string and an array.

Tags
author

Damien Fayet damienf1521@gmail.com

Interfaces, Classes, Traits and Enums

DataTransformerInterface
Transforms a value between different representations.

Table of Contents

reverseTransform()  : string|null
Transforms an array into a week date string.
transform()  : array<string|int, mixed>
Transforms a string containing an ISO 8601 week date into an array.

Methods

reverseTransform()

Transforms an array into a week date string.

public reverseTransform(array<string|int, mixed> $value) : string|null
Parameters
$value : array<string|int, mixed>

An array containing a year and a week number

Tags
throws
TransformationFailedException

If the given value can not be merged in a valid week date string, or if the obtained week date does not exists

Return values
string|null

A week date string following the format Y-\WW

transform()

Transforms a string containing an ISO 8601 week date into an array.

public transform(string|null $value) : array<string|int, mixed>
Parameters
$value : string|null

A week date string

Tags
throws
TransformationFailedException

If the given value is not a string, or if the given value does not follow the right format

Return values
array<string|int, mixed>

A value containing year and week

Search results