src/VK/TransportClient/Curl/CurlHttpClient.php
protected function getHeaders(string $raw_headers) {
        // Normalize line breaks
        $raw_headers = str_replace("\r\n", "\n", $raw_headers);

        // There will be multiple headers if a 301 was followed
        // or a proxy was followed, etc
        $header_collection = explode("\n\n", trim($raw_headers));
        // We just want the last response (at the end)
        $raw_header = array_pop($header_collection);

        $header_components = explode("\n", $raw_header);
        $result = array();
        $http_status = 0;
        foreach ($header_components as $line) {
            if (strpos($line, ': ') === false) {
                $http_status = $this->getHttpStatus($line);
            } else {
                list($key, $value) = explode(': ', $line, 2);
                $result[$key] = $value;
            }
        }

        return array($http_status, $result);
    }
protected function getHeaders(string $raw_headers) {
        // Normalize line breaks
        $raw_headers = str_replace("\r\n", "\n", $raw_headers);

        // There will be multiple headers if a 301 was followed
        // or a proxy was followed, etc
        $header_collection = explode("\n\n", trim($raw_headers));
        // We just want the last response (at the end)
        $raw_header = array_pop($header_collection);

        $header_components = explode("\n", $raw_header);
        $result = array();
        $http_status = 0;
        foreach ($header_components as $line) {
            if (strpos($line, ': ') === false) {
                $http_status = $this->getHttpStatus($line);
            } else {
                list($key, $value) = explode(': ', $line, 2);
                $result[$key] = $value;
            }
        }

        return array($http_status, $result);
    }
protected function getHeaders ( string $ raw_headers ) { // Normalize line breaks $ raw_headers = str_replace ( "\r\n" , "\n" , $ raw_headers ) ; // There will be multiple headers if a 301 was followed // or a proxy was followed, etc $ header_collection = explode ( "\n\n" , trim ( $ raw_headers ) ) ; // We just want the last response (at the end) $ raw_header = array_pop ( $ header_collection ) ; $ header_components = explode ( "\n" , $ raw_header ) ; $ result = array ( ) ; $ http_status = 0 ; foreach ( $ header_components as $ line ) { if ( strpos ( $ line , ': ' ) === false ) { $ http_status = $ this -> getHttpStatus ( $ line ) ; } else { list ( $ key , $ value ) = explode ( ': ' , $ line , 2 ) ; $ result [ $ key ] = $ value ; } } return array ( $ http_status , $ result ) ; }
Parses the raw headers and sets as an array.

@param string The raw headers from the response.

@return array
Parses the raw headers and sets as an array .