protected function setResponseHeaders(array $headers = [])
	{
		foreach ($headers as $header)
		{
			if (($pos = strpos($header, ':')) !== false)
			{
				$title = substr($header, 0, $pos);
				$value = substr($header, $pos + 1);

				$this->response->setHeader($title, $value);
			}
			else if (strpos($header, 'HTTP') === 0)
			{
				preg_match('#^HTTP\/([12]\.[01]) ([0-9]+) (.+)#', $header, $matches);

				if (isset($matches[1]))
				{
					$this->response->setProtocolVersion($matches[1]);
				}

				if (isset($matches[2]))
				{
					$this->response->setStatusCode($matches[2], $matches[3] ?? null);
				}
			}
		}
	}
protected function setResponseHeaders(array $headers = [])
	{
		foreach ($headers as $header)
		{
			if (($pos = strpos($header, ':')) !== false)
			{
				$title = substr($header, 0, $pos);
				$value = substr($header, $pos + 1);

				$this->response->setHeader($title, $value);
			}
			else if (strpos($header, 'HTTP') === 0)
			{
				preg_match('#^HTTP\/([12]\.[01]) ([0-9]+) (.+)#', $header, $matches);

				if (isset($matches[1]))
				{
					$this->response->setProtocolVersion($matches[1]);
				}

				if (isset($matches[2]))
				{
					$this->response->setStatusCode($matches[2], $matches[3] ?? null);
				}
			}
		}
	}
protected function setResponseHeaders ( array $ headers = [ ] ) { foreach ( $ headers as $ header ) { if ( ( $ pos = strpos ( $ header , ':' ) ) !== false ) { $ title = substr ( $ header , 0 , $ pos ) ; $ value = substr ( $ header , $ pos + 1 ) ; $ this -> response -> setHeader ( $ title , $ value ) ; } else if ( strpos ( $ header , 'HTTP' ) === 0 ) { preg_match ( '#^HTTP\/([12]\.[01]) ([0-9]+) (.+)#' , $ header , $ matches ) ; if ( isset ( $ matches [ 1 ] ) ) { $ this -> response -> setProtocolVersion ( $ matches [ 1 ] ) ; } if ( isset ( $ matches [ 2 ] ) ) { $ this -> response -> setStatusCode ( $ matches [ 2 ] , $ matches [ 3 ] ?? null ) ; } } } }
Parses the header retrieved from the cURL response into
our Response object.

@param array $headers
Parses the header retrieved from the cURL response into our Response object .