IMP_Indices::_fromSequenceString PHP Method

_fromSequenceString() protected method

Extends Horde_Imap_Client_Ids by allowing mailbox information to appear in the string.
protected _fromSequenceString ( string $str ) : array
$str string The IMAP message sequence string.
return array An array of indices. If string contains mailbox info, return value will be an array of arrays, with keys as mailbox names and values as IDs. Otherwise, return the list of IDs.
    protected function _fromSequenceString($str)
    {
        $str = trim($str);
        if (!strlen($str)) {
            return array();
        }
        if ($str[0] != '{') {
            return $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create()->getIdsOb($str)->ids;
        }
        $i = strpos($str, '}');
        $count = intval(substr($str, 1, $i - 1));
        $mbox = substr($str, $i + 1, $count);
        $i += $count + 1;
        $end = strpos($str, '{', $i);
        if ($end === false) {
            $ids = array();
            $uidstr = substr($str, $i);
        } else {
            $ids = $this->_fromSequenceString(substr($str, $end));
            $uidstr = substr($str, $i, $end - $i);
        }
        $ids[$mbox] = $this->_fromSequenceString($uidstr);
        return $ids;
    }