hydrateFeeSpecification.php
Table of Contents
Functions
- hydrateFeeSpecification() : FeeSpecification|null
- Hydrate an array definition with the FeeSpecification class, down to the rate it derives from.
Functions
hydrateFeeSpecification()
Hydrate an array definition with the FeeSpecification class, down to the rate it derives from.
hydrateFeeSpecification([mixed $init = null ]) : FeeSpecification|null
A fee is read in two places at once — price to compute an amount, rate to
explain it — and the two carry different units on purpose. Typing the head
alone would leave a consumer reading ->price on the fee and
['price'] on the rate beside it, on a pair whose whole point is that both
are read together.
The issuing body is typed too, through hydrateOrganizationOrPerson(),
which reads the payload's @type rather than guessing from the declared
union.
⚠️ Only the constructor path needs this. Reflection::hydrate() types both on
its own, FeeSpecification::$rate declaring the attribute for it.
Use it in the 'products' definition in the DI container.
Parameters
- $init : mixed = null