private function parseHeader($rawHeader) {

        // Initialize the headers.
        $headers = [];
        $key     = "";

        // Handle each header.
        foreach (explode("\n", $rawHeader) as $h) {
            $h = explode(":", $h, 2);
            if (true === isset($h[1])) {
                if (false === isset($headers[$h[0]])) {
                    $headers[$h[0]] = trim($h[1]);
                } elseif (true === is_array($headers[$h[0]])) {
                    $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]);
                } else {
                    $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]);
                }
                $key = $h[0];
            } else {
                if ("\t" === substr($h[0], 0, 1)) {
                    $headers[$key] .= "\r\n\t" . trim($h[0]);
                } elseif (!$key) {
                    $headers[0] = trim($h[0]);
                }
                trim($h[0]);
            }
        }

        // Return the headers.
        return $headers;
    }
private function parseHeader($rawHeader) {

        // Initialize the headers.
        $headers = [];
        $key     = "";

        // Handle each header.
        foreach (explode("\n", $rawHeader) as $h) {
            $h = explode(":", $h, 2);
            if (true === isset($h[1])) {
                if (false === isset($headers[$h[0]])) {
                    $headers[$h[0]] = trim($h[1]);
                } elseif (true === is_array($headers[$h[0]])) {
                    $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]);
                } else {
                    $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]);
                }
                $key = $h[0];
            } else {
                if ("\t" === substr($h[0], 0, 1)) {
                    $headers[$key] .= "\r\n\t" . trim($h[0]);
                } elseif (!$key) {
                    $headers[0] = trim($h[0]);
                }
                trim($h[0]);
            }
        }

        // Return the headers.
        return $headers;
    }
private function parseHeader ( $ rawHeader ) { // Initialize the headers. $ headers = [ ] ; $ key = "" ; // Handle each header. foreach ( explode ( "\n" , $ rawHeader ) as $ h ) { $ h = explode ( ":" , $ h , 2 ) ; if ( true === isset ( $ h [ 1 ] ) ) { if ( false === isset ( $ headers [ $ h [ 0 ] ] ) ) { $ headers [ $ h [ 0 ] ] = trim ( $ h [ 1 ] ) ; } elseif ( true === is_array ( $ headers [ $ h [ 0 ] ] ) ) { $ headers [ $ h [ 0 ] ] = array_merge ( $ headers [ $ h [ 0 ] ] , [ trim ( $ h [ 1 ] ) ] ) ; } else { $ headers [ $ h [ 0 ] ] = array_merge ( [ $ headers [ $ h [ 0 ] ] ] , [ trim ( $ h [ 1 ] ) ] ) ; } $ key = $ h [ 0 ] ; } else { if ( "\t" === substr ( $ h [ 0 ] , 0 , 1 ) ) { $ headers [ $ key ] .= "\r\n\t" . trim ( $ h [ 0 ] ) ; } elseif ( ! $ key ) { $ headers [ 0 ] = trim ( $ h [ 0 ] ) ; } trim ( $ h [ 0 ] ) ; } } // Return the headers. return $ headers ; }
Parse the raw header.

@param string $rawHeader The raw header.
@return array Returns the headers.
Parse the raw header .