private function parseHeaders($headers)
    {
        $result = [];

        foreach (preg_split("/\\r\\n|\\r|\\n/", $headers) as $row) {
            $header = explode(':', $row, 2);

            if (count($header) == 2) {
                $result[$header[0]] = trim($header[1]);
            }
            else {
                $result[] = $header[0];
            }
        }

        return $result;
    }
private function parseHeaders($headers)
    {
        $result = [];

        foreach (preg_split("/\\r\\n|\\r|\\n/", $headers) as $row) {
            $header = explode(':', $row, 2);

            if (count($header) == 2) {
                $result[$header[0]] = trim($header[1]);
            }
            else {
                $result[] = $header[0];
            }
        }

        return $result;
    }
private function parseHeaders ( $ headers ) { $ result = [ ] ; foreach ( preg_split ( "/\\r\\n|\\r|\\n/" , $ headers ) as $ row ) { $ header = explode ( ':' , $ row , 2 ) ; if ( count ( $ header ) == 2 ) { $ result [ $ header [ 0 ] ] = trim ( $ header [ 1 ] ) ; } else { $ result [ ] = $ header [ 0 ] ; } } return $ result ; }
Parse string headers into array

@param string $headers

@return array
Parse string headers into array