Horde_Imap_Client_Socket::_enable PHP Method

_enable() protected method

Enable an IMAP extension (see RFC 5161).
protected _enable ( array $exts )
$exts array The extensions to enable.
    protected function _enable($exts)
    {
        if (!empty($exts) && $this->_capability('ENABLE')) {
            $c = $this->_capability();
            $todo = array();
            // Only enable non-enabled extensions.
            foreach ($exts as $val) {
                if (!$c->isEnabled($val)) {
                    $c->enable($val);
                    $todo[] = $val;
                }
            }
            if (!empty($todo)) {
                $cmd = $this->_command('ENABLE')->add($todo);
                $cmd->on_error = function () use($todo, $c) {
                    /* Something went wrong... disable the extensions. */
                    foreach ($todo as $val) {
                        $c->enable($val, false);
                    }
                };
                $this->_cmdQueue[] = $cmd;
            }
        }
    }