/** * @param string $headersJson * @return HeaderParameter\ParameterInterface[] */ protected function parseHeaders($headersJson) { $parameters = []; $headers = json_decode($headersJson, true); foreach ($headers as $name => $value) { $parameter = $this->headerParameterFactory->get($name); $parameter->setValue($value); $parameters[] = $parameter; } return $parameters; }
/** * @param string $headersJson * * @return HeaderParameter\ParameterInterface[] * @throws \InvalidArgumentException */ protected function parseHeaders($headersJson) { $parameters = []; $headers = json_decode($headersJson, true); if (!is_array($headers) || empty($headers)) { throw new \InvalidArgumentException('Not a valid header of JWT string passed for deserialization'); } foreach ($headers as $name => $value) { $parameter = $this->headerParameterFactory->get($name); $parameter->setValue($value); $parameters[] = $parameter; } return $parameters; }