Horde_Imap_Client_Base::store PHP Method

store() public method

Store message flag data (see RFC 3501 [6.4.6]).
public store ( mixed $mailbox, array $options = [] ) : Horde_Imap_Client_Ids
$mailbox mixed The mailbox containing the messages to modify. Either a Horde_Imap_Client_Mailbox object or a string (UTF-8).
$options array Additional options: - add: (array) An array of flags to add. DEFAULT: No flags added. - ids: (Horde_Imap_Client_Ids) The list of messages to modify. DEFAULT: All messages in $mailbox will be modified. - remove: (array) An array of flags to remove. DEFAULT: No flags removed. - replace: (array) Replace the current flags with this set of flags. Overrides both the 'add' and 'remove' options. DEFAULT: No replace is performed. - unchangedsince: (integer) Only changes flags if the mod-sequence ID of the message is equal or less than this value. Requires the CONDSTORE IMAP extension on the server. Also requires the mailbox to support mod-sequences. Will throw an exception if either condition is not met. DEFAULT: mod-sequence is ignored when applying changes
return Horde_Imap_Client_Ids A Horde_Imap_Client_Ids object containing the list of IDs that failed the 'unchangedsince' test.
    public function store($mailbox, array $options = array())
    {
        // Open mailbox call will handle the login.
        $this->openMailbox($mailbox, Horde_Imap_Client::OPEN_READWRITE);
        /* SEARCHRES requires server support. */
        if (empty($options['ids'])) {
            $options['ids'] = $this->getIdsOb(Horde_Imap_Client_Ids::ALL);
        } elseif ($options['ids']->isEmpty()) {
            return $this->getIdsOb();
        } elseif ($options['ids']->search_res && !$this->_capability('SEARCHRES')) {
            throw new Horde_Imap_Client_Exception_NoSupportExtension('SEARCHRES');
        }
        if (!empty($options['unchangedsince'])) {
            if (!$this->_capability()->isEnabled('CONDSTORE')) {
                throw new Horde_Imap_Client_Exception_NoSupportExtension('CONDSTORE');
            }
            /* RFC 7162 [3.1.2.2] - trying to do a UNCHANGEDSINCE STORE on a
             * mailbox that doesn't support it will return BAD. */
            if (!$this->_mailboxOb()->getStatus(Horde_Imap_Client::STATUS_HIGHESTMODSEQ)) {
                throw new Horde_Imap_Client_Exception(Horde_Imap_Client_Translation::r("Mailbox does not support mod-sequences."), Horde_Imap_Client_Exception::MBOXNOMODSEQ);
            }
        }
        return $this->_store($options);
    }