label) === '') { throw new InvalidArgumentException('Count descriptors require a label.'); } if (! in_array($this->role, [ self::ROLE_EXECUTION, self::ROLE_EVALUATION_OUTPUT, self::ROLE_COVERAGE, self::ROLE_RELIABILITY_SIGNAL, ], true)) { throw new InvalidArgumentException('Unsupported count descriptor role: '.$this->role); } if (! in_array($this->visibilityTier, [self::VISIBILITY_PRIMARY, self::VISIBILITY_DIAGNOSTIC], true)) { throw new InvalidArgumentException('Unsupported count descriptor visibility tier: '.$this->visibilityTier); } } /** * @return array{ * label: string, * value: int, * role: string, * qualifier: ?string, * visibilityTier: string * } */ public function toArray(): array { return [ 'label' => $this->label, 'value' => $this->value, 'role' => $this->role, 'qualifier' => $this->qualifier, 'visibilityTier' => $this->visibilityTier, ]; } }