src/Token/Parser.php
private function parseHeader(string $data): array
    {
        $header = $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));

        if (! is_array($header)) {
            throw new InvalidArgumentException('Headers must be an array');
        }

        if (isset($header['enc'])) {
            throw new InvalidArgumentException('Encryption is not supported yet');
        }

        if (! isset($header['typ'])) {
            throw new InvalidArgumentException('The header "typ" must be present');
        }

        return $header;
    }
private function parseHeader(string $data): array
    {
        $header = $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));

        if (! is_array($header)) {
            throw new InvalidArgumentException('Headers must be an array');
        }

        if (isset($header['enc'])) {
            throw new InvalidArgumentException('Encryption is not supported yet');
        }

        if (! isset($header['typ'])) {
            throw new InvalidArgumentException('The header "typ" must be present');
        }

        return $header;
    }
Parses the header from a string

@return mixed[]

@throws InvalidArgumentException When an invalid header is informed.