issuers = $issuer; $this->protectedHeader = $protectedHeader; } /** * @param mixed $value * * @throws InvalidClaimException if the claim is invalid */ public function checkClaim($value): void { $this->checkValue($value, InvalidClaimException::class); } /** * @param mixed $value * * @throws InvalidHeaderException if the header parameter is invalid */ public function checkHeader($value): void { $this->checkValue($value, InvalidHeaderException::class); } public function supportedClaim(): string { return self::CLAIM_NAME; } public function supportedHeader(): string { return self::CLAIM_NAME; } public function protectedHeaderOnly(): bool { return $this->protectedHeader; } /** * @param mixed $value * * @throws InvalidClaimException if the claim is invalid * @throws InvalidHeaderException if the header parameter is invalid */ private function checkValue($value, string $class): void { if (!is_string($value)) { throw new $class('Invalid value.', self::CLAIM_NAME, $value); } if (!in_array($value, $this->issuers, true)) { throw new $class('Unknown issuer.', self::CLAIM_NAME, $value); } } }