20 lines
585 B
PHP
20 lines
585 B
PHP
<?php
|
|
|
|
/** Values derived from a submission (not entered by the visitor), exposed to templates. */
|
|
final class RsvFormCalculatedValues {
|
|
/** @return array<string, mixed> */
|
|
public function for(RsvFormDefinition $definition, RsvFormData $data): array {
|
|
return [
|
|
'price' => (new RsvFormPriceCalculator())->calculate($definition, $data),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* The names these values expose, so template validation accepts {{ price }}.
|
|
* @return list<string>
|
|
*/
|
|
public static function names(): array {
|
|
return ['price'];
|
|
}
|
|
}
|