use DateTime;
class CustomerOrderHydrator{ /**
* @param array<string, mixed> $data
*
* @return CustomerOrder
*/
public function hydrate(array
$data) { $struct =
new CustomerOrder();
if (empty($data)) { return $struct;
} $struct->
setOrderCount((int) ($data['count_orders'
] ?? 0
));
$struct->
setTotalAmount((float) ($data['invoice_amount_sum'
] ?? 0.0
));
$struct->
setAvgAmount((float) ($data['invoice_amount_avg'
] ?? 0.0
));
$struct->
setMinAmount((float) ($data['invoice_amount_min'
] ?? 0.0
));
$struct->
setMaxAmount((float) ($data['invoice_amount_max'
] ?? 0.0
));
$struct->
setAvgProductPrice((float) ($data['product_avg'
] ?? 0.0
));