code/libraries/joomlatools/library/http/message/headers.php
public function toArray()
    {
        $headers = array();

        //Method to implode header parameters
        $implode = function($parameters)
        {
            $results = array();
            foreach ($parameters as $key => $parameter)
            {
                if(!is_numeric($key))
                {
                    //Parameters
                    if(is_array($parameter))
                    {
                        $modifiers = array();
                        foreach($parameter as $k => $v) {
                            $modifiers[] = $k.'='.$v;
                        }

                        $results[] = $key.';'.implode($modifiers, ',');
                    }
                    else $results[] = $key.'='.$parameter;
                }
                else $results[] = $parameter;
            }

            return $value = implode($results, ', ');
        };

        //Serialise the headers to an array
        ksort($this->_data);
        foreach ($this->_data as $name => $values)
        {
            $name    = implode('-', array_map('ucfirst', explode('-', $name)));
            $results = array();

            foreach($values as $value)
            {
                if(is_array($value)) {
                    $results[] = $implode($value);
                }  else {
                    $results[] = $value;
                }
            }

            if ($value = implode($results, ', ')) {
                $headers[$name] = $value;
            }
        }

        return $headers;
    }
public function toArray()
    {
        $headers = array();

        //Method to implode header parameters
        $implode = function($parameters)
        {
            $results = array();
            foreach ($parameters as $key => $parameter)
            {
                if(!is_numeric($key))
                {
                    //Parameters
                    if(is_array($parameter))
                    {
                        $modifiers = array();
                        foreach($parameter as $k => $v) {
                            $modifiers[] = $k.'='.$v;
                        }

                        $results[] = $key.';'.implode($modifiers, ',');
                    }
                    else $results[] = $key.'='.$parameter;
                }
                else $results[] = $parameter;
            }

            return $value = implode($results, ', ');
        };

        //Serialise the headers to an array
        ksort($this->_data);
        foreach ($this->_data as $name => $values)
        {
            $name    = implode('-', array_map('ucfirst', explode('-', $name)));
            $results = array();

            foreach($values as $value)
            {
                if(is_array($value)) {
                    $results[] = $implode($value);
                }  else {
                    $results[] = $value;
                }
            }

            if ($value = implode($results, ', ')) {
                $headers[$name] = $value;
            }
        }

        return $headers;
    }
public function toArray ( ) { $ headers = array ( ) ; //Method to implode header parameters $ implode = function ( $ parameters ) { $ results = array ( ) ; foreach ( $ parameters as $ key => $ parameter ) { if ( ! is_numeric ( $ key ) ) { //Parameters if ( is_array ( $ parameter ) ) { $ modifiers = array ( ) ; foreach ( $ parameter as $ k => $ v ) { $ modifiers [ ] = $ k . '=' . $ v ; } $ results [ ] = $ key . ';' . implode ( $ modifiers , ',' ) ; } else $ results [ ] = $ key . '=' . $ parameter ; } else $ results [ ] = $ parameter ; } return $ value = implode ( $ results , ', ' ) ; } ; //Serialise the headers to an array ksort ( $ this -> _data ) ; foreach ( $ this -> _data as $ name => $ values ) { $ name = implode ( '-' , array_map ( 'ucfirst' , explode ( '-' , $ name ) ) ) ; $ results = array ( ) ; foreach ( $ values as $ value ) { if ( is_array ( $ value ) ) { $ results [ ] = $ implode ( $ value ) ; } else { $ results [ ] = $ value ; } } if ( $ value = implode ( $ results , ', ' ) ) { $ headers [ $ name ] = $ value ; } } return $ headers ; }
Returns the headers as an array

@return array An associative array
Returns the headers as an array