type = trim($type); $this->value = trim($value); $this->domain = trim($domain); $this->weight = max(0.0, min(1.0, $weight)); $this->reason = trim($reason); } public function getType(): string { return $this->type; } public function getValue(): string { return $this->value; } public function getDomain(): string { return $this->domain; } public function getWeight(): float { return $this->weight; } public function getReason(): string { return $this->reason; } public function toArray(): array { return [ 'type' => $this->type, 'value' => $this->value, 'domain' => $this->domain, 'weight' => $this->weight, 'reason' => $this->reason, ]; } }