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#
| Method | Description |
|---|---|
->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>| Parameter | Type | Description |
|---|---|---|
$dto | object |
- Returns
array<string, mixed>
value()#
public function value(mixed $value): mixedNormalizes 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.
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
- Returns
mixed