supportedAlgorithms = $supportedAlgorithms; $this->protectedHeader = $protectedHeader; } /** * {@inheritdoc} * * @throws InvalidHeaderException if the header is invalid */ public function checkHeader($value): void { if (!is_string($value)) { throw new InvalidHeaderException('"enc" must be a string.', self::HEADER_NAME, $value); } if (!in_array($value, $this->supportedAlgorithms, true)) { throw new InvalidHeaderException('Unsupported algorithm.', self::HEADER_NAME, $value); } } public function supportedHeader(): string { return self::HEADER_NAME; } public function protectedHeaderOnly(): bool { return $this->protectedHeader; } }