Zum Inhalt springen

API reference / Quittio \ Core \ Serialization

ArrayNormalizer

final class in quittio/core

Quittio\Core\Serialization\ArrayNormalizer · Source

Converts DTOs into plain arrays (scalars only) for JSON, storage and APIs.

Values equal to the constructor default are omitted to keep the output compact; the hydrator restores them from the defaults.

Methods#

MethodDescription
->normalize()
->value()Normalizes one value: amounts as strings with two decimals, decimals as strings, dates as ISO strings, enums and codes as their value, arrays element by element and other objects with normalize(). Null and scalars stay as they are.

normalize()#

public function normalize(object $dto): array<string, mixed>
ParameterTypeDescription
$dtoobject
Returns
array<string, mixed>

value()#

public function value(mixed $value): mixed

Normalizes one value: amounts as strings with two decimals, decimals as strings, dates as ISO strings, enums and codes as their value, arrays element by element and other objects with normalize(). Null and scalars stay as they are.

ParameterTypeDescription
$valuemixed
Returns
mixed

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.