*/ public $scores; public function __construct( MessageType $decision, MessageType $machineDecision, string $method, float $confidence, array $scores = [] ) { $this->decision = $decision; $this->machineDecision = $machineDecision; $this->method = $method; $this->confidence = $confidence; $this->scores = $scores; foreach ($scores as $label => $score) { if (empty($label) || !is_string($label)) { throw new \InvalidArgumentException("Label de score invalide : " . var_export($label, true)); } if ((!is_float($score) && !is_int($score)) || $score < 0.0 || $score > 1.0) { throw new \InvalidArgumentException("Score de label '$label' invalide : " . var_export($score, true)); } } } }