valid; } public function getMessage(): ?string { return $this->reason; } public function getCoupon(): ?Coupon { return $this->coupon; } /** * @return array */ public function toArray(): array { return [ 'valid' => $this->valid, 'reason' => $this->reason, 'discount_amount' => $this->discountAmount, 'discount_type' => $this->discountType, 'coupon' => $this->coupon?->toArray(), ]; } public function __get(string $name): mixed { return match ($name) { 'discount_amount' => $this->discountAmount, 'discount_type' => $this->discountType, default => null, }; } }