thomascube
2012-01-16 c321a955a7b0f6d6b13ffaebf040a6c7091037ae
program/include/rcube_result_index.php
@@ -17,7 +17,7 @@
 | Author: Aleksander Machniak <alec@alec.pl>                            |
 +-----------------------------------------------------------------------+
 $Id: rcube_imap.php 5347 2011-10-19 06:35:29Z alec $
 $Id$
*/
@@ -27,11 +27,11 @@
 */
class rcube_result_index
{
    private $raw_data;
    private $mailbox;
    private $meta = array();
    private $params = array();
    private $order = 'ASC';
    protected $raw_data;
    protected $mailbox;
    protected $meta = array();
    protected $params = array();
    protected $order = 'ASC';
    const SEPARATOR_ELEMENT = ' ';
@@ -126,7 +126,7 @@
     *
     * @return bool True if the result is an error, False otherwise
     */
    public function isError()
    public function is_error()
    {
        return $this->raw_data === null ? true : false;
    }
@@ -137,7 +137,7 @@
     *
     * @return bool True if the result is empty, False otherwise
     */
    public function isEmpty()
    public function is_empty()
    {
        return empty($this->raw_data) ? true : false;
    }
@@ -157,9 +157,9 @@
            $this->meta['count']  = 0;
            $this->meta['length'] = 0;
        }
        else
            // @TODO: check performance substr_count() vs. explode()
        else {
            $this->meta['count'] = 1 + substr_count($this->raw_data, self::SEPARATOR_ELEMENT);
        }
        return $this->meta['count'];
    }
@@ -171,7 +171,7 @@
     *
     * @return int Number of elements
     */
    public function countMessages()
    public function count_messages()
    {
        return $this->count();
    }
@@ -185,7 +185,6 @@
    public function max()
    {
        if (!isset($this->meta['max'])) {
            // @TODO: do it by parsing raw_data?
            $this->meta['max'] = (int) @max($this->get());
        }
@@ -201,7 +200,6 @@
    public function min()
    {
        if (!isset($this->meta['min'])) {
            // @TODO: do it by parsing raw_data?
            $this->meta['min'] = (int) @min($this->get());
        }
@@ -307,7 +305,7 @@
                if ($m[0][1]) {
                    $idx = 1 + substr_count($this->raw_data, self::SEPARATOR_ELEMENT, 0, $m[0][1]);
                }
                // cache position of this element, so we can use it in getElement()
                // cache position of this element, so we can use it in get_element()
                $this->meta['pos'][$idx] = (int)$m[0][1];
                return $idx;
@@ -338,7 +336,7 @@
     *
     * @return array List of message IDs
     */
    public function getCompressed()
    public function get_compressed()
    {
        if (empty($this->raw_data)) {
            return '';
@@ -355,7 +353,7 @@
     *
     * @return int Element value
     */
    public function getElement($index)
    public function get_element($index)
    {
        $count = $this->count();
@@ -416,7 +414,7 @@
     *
     * @return array|string Response parameters or parameter value
     */
    public function getParameters($param=null)
    public function get_parameters($param=null)
    {
        $params = $this->params;
        $params['MAILBOX'] = $this->mailbox;
@@ -435,7 +433,7 @@
     *
     * @return int Data length
     */
    private function length()
    protected function length()
    {
        if (!isset($this->meta['length'])) {
            $this->meta['length'] = strlen($this->raw_data);