formatCurrency( $amount->getAmount() / 100, $amount->getCurrency()->getCode() ) ?: $amount->getAmount() / 100 . ' ' . $amount->getCurrency()->getCode(); } /** @return array{amount:string,currency:string,formatted:string}|null */ public static function serialized( ?Money $amount, ): ?array { if ($amount === null) { return null; } return [ 'amount' => $amount->getAmount(), 'currency' => $amount->getCurrency()->getCode(), 'formatted' => self::formatted($amount), ]; } }