protected function _getHeaders($id, $format, $key)
    {
        switch ($format) {
        case self::HEADER_STREAM:
            if (!isset($this->_data[$key][$id])) {
                $data = null;
            } elseif (is_object($this->_data[$key][$id])) {
                switch ($key) {
                case Horde_Imap_Client::FETCH_HEADERS:
                    $data = $this->_getHeaders($id, 0, $key);
                    break;

                case Horde_Imap_Client::FETCH_HEADERTEXT:
                case Horde_Imap_Client::FETCH_MIMEHEADER:
                    $data = $this->_data[$key][$id];
                    break;
                }
            } else {
                $data = $this->_data[$key][$id];
            }

            return $this->_msgText(true, $data);

        case self::HEADER_PARSE:
            if (!isset($this->_data[$key][$id])) {
                return new Horde_Mime_Headers();
            } elseif (is_object($this->_data[$key][$id])) {
                switch ($key) {
                case Horde_Imap_Client::FETCH_HEADERS:
                    return clone $this->_data[$key][$id];

                case Horde_Imap_Client::FETCH_HEADERTEXT:
                case Horde_Imap_Client::FETCH_MIMEHEADER:
                    $hdrs = $this->_data[$key][$id];
                    break;
                }
            } else {
                $hdrs = $this->_getHeaders($id, self::HEADER_STREAM, $key);
            }

            return Horde_Mime_Headers::parseHeaders($hdrs);
        }

        if (!isset($this->_data[$key][$id])) {
            return '';
        }

        if (is_object($this->_data[$key][$id])) {
            switch ($key) {
            case Horde_Imap_Client::FETCH_HEADERS:
                return $this->_data[$key][$id]->toString(
                    array('nowrap' => true)
                );

            case Horde_Imap_Client::FETCH_HEADERTEXT:
            case Horde_Imap_Client::FETCH_MIMEHEADER:
                return strval($this->_data[$key][$id]);
            }
        }

        return $this->_msgText(false, $this->_data[$key][$id]);
    }
protected function _getHeaders($id, $format, $key)
    {
        switch ($format) {
        case self::HEADER_STREAM:
            if (!isset($this->_data[$key][$id])) {
                $data = null;
            } elseif (is_object($this->_data[$key][$id])) {
                switch ($key) {
                case Horde_Imap_Client::FETCH_HEADERS:
                    $data = $this->_getHeaders($id, 0, $key);
                    break;

                case Horde_Imap_Client::FETCH_HEADERTEXT:
                case Horde_Imap_Client::FETCH_MIMEHEADER:
                    $data = $this->_data[$key][$id];
                    break;
                }
            } else {
                $data = $this->_data[$key][$id];
            }

            return $this->_msgText(true, $data);

        case self::HEADER_PARSE:
            if (!isset($this->_data[$key][$id])) {
                return new Horde_Mime_Headers();
            } elseif (is_object($this->_data[$key][$id])) {
                switch ($key) {
                case Horde_Imap_Client::FETCH_HEADERS:
                    return clone $this->_data[$key][$id];

                case Horde_Imap_Client::FETCH_HEADERTEXT:
                case Horde_Imap_Client::FETCH_MIMEHEADER:
                    $hdrs = $this->_data[$key][$id];
                    break;
                }
            } else {
                $hdrs = $this->_getHeaders($id, self::HEADER_STREAM, $key);
            }

            return Horde_Mime_Headers::parseHeaders($hdrs);
        }

        if (!isset($this->_data[$key][$id])) {
            return '';
        }

        if (is_object($this->_data[$key][$id])) {
            switch ($key) {
            case Horde_Imap_Client::FETCH_HEADERS:
                return $this->_data[$key][$id]->toString(
                    array('nowrap' => true)
                );

            case Horde_Imap_Client::FETCH_HEADERTEXT:
            case Horde_Imap_Client::FETCH_MIMEHEADER:
                return strval($this->_data[$key][$id]);
            }
        }

        return $this->_msgText(false, $this->_data[$key][$id]);
    }
protected function _getHeaders ( $ id , $ format , $ key ) { switch ( $ format ) { case self :: HEADER_STREAM : if ( ! isset ( $ this -> _data [ $ key ] [ $ id ] ) ) { $ data = null ; } elseif ( is_object ( $ this -> _data [ $ key ] [ $ id ] ) ) { switch ( $ key ) { case Horde_Imap_Client :: FETCH_HEADERS : $ data = $ this -> _getHeaders ( $ id , 0 , $ key ) ; break ; case Horde_Imap_Client :: FETCH_HEADERTEXT : case Horde_Imap_Client :: FETCH_MIMEHEADER : $ data = $ this -> _data [ $ key ] [ $ id ] ; break ; } } else { $ data = $ this -> _data [ $ key ] [ $ id ] ; } return $ this -> _msgText ( true , $ data ) ; case self :: HEADER_PARSE : if ( ! isset ( $ this -> _data [ $ key ] [ $ id ] ) ) { return new Horde_Mime_Headers ( ) ; } elseif ( is_object ( $ this -> _data [ $ key ] [ $ id ] ) ) { switch ( $ key ) { case Horde_Imap_Client :: FETCH_HEADERS : return clone $ this -> _data [ $ key ] [ $ id ] ; case Horde_Imap_Client :: FETCH_HEADERTEXT : case Horde_Imap_Client :: FETCH_MIMEHEADER : $ hdrs = $ this -> _data [ $ key ] [ $ id ] ; break ; } } else { $ hdrs = $ this -> _getHeaders ( $ id , self :: HEADER_STREAM , $ key ) ; } return Horde_Mime_Headers :: parseHeaders ( $ hdrs ) ; } if ( ! isset ( $ this -> _data [ $ key ] [ $ id ] ) ) { return '' ; } if ( is_object ( $ this -> _data [ $ key ] [ $ id ] ) ) { switch ( $ key ) { case Horde_Imap_Client :: FETCH_HEADERS : return $ this -> _data [ $ key ] [ $ id ] -> toString ( array ( 'nowrap' => true ) ) ; case Horde_Imap_Client :: FETCH_HEADERTEXT : case Horde_Imap_Client :: FETCH_MIMEHEADER : return strval ( $ this -> _data [ $ key ] [ $ id ] ) ; } } return $ this -> _msgText ( false , $ this -> _data [ $ key ] [ $ id ] ) ; }
Return representation of a header field.

@param string $id       The header id.
@param integer $format  The return format. If self::HEADER_PARSE,
returns a Horde_Mime_Headers object. If
self::HEADER_STREAM, returns a stream.
Otherwise, returns header text.
@param integer $key     The array key where the data is stored in the
internal array.

@return mixed  The data in the format specified by $format.
Return representation of a header field .