score < 0 || $this->score > 100) { throw new InvalidArgumentException('Fraud score must be between 0 and 100.'); } if (! in_array($this->recommendation, ['approve', 'review', 'block'], true)) { throw new InvalidArgumentException('Fraud recommendation must be approve, review, or block.'); } } /** * @return array{score: int, signals: array, recommendation: string} */ public function toArray(): array { return [ 'score' => $this->score, 'signals' => $this->signals, 'recommendation' => $this->recommendation, ]; } }