Set Cookie to Cookies->$cookie list, cookie of the same name will be overwritten

@param $options

@return $this
431060
public function setCookie(array $options): self
    {
        if (isset($options['name']) && is_string($options['name'])) {
            //正常COOKIE的设定
            $this->cookies->add($options);
        } else {
            if (key($options) === 0) {
                //数组COOKIE的设定
                foreach ($options as $parent_name => $obj) {
                    $obj['name'] = $parent_name . '[' . $obj['name'] . ']';
                    $this->cookies->add($obj);
                }
            }
        }

        return $this;
    }
585793
public function setOptions(array $options)
    {
        if ($this->options && is_array($options)) {
            $options = ArrayUtils::merge($this->options, $options);
        }

        $this->options = $options;

        return $this;
    }
534645
public function setOptions($options)
    {
        if (array_key_exists('allow', $options)) {
            $this->setAllow($options['allow']);
        }

        if (array_key_exists('idn', $options)) {
            $this->setValidateIdn($options['idn']);
        }

        if (array_key_exists('tld', $options)) {
            $this->setValidateTld($options['tld']);
        }

        if (array_key_exists('ip', $options)) {
            $this->setIpValidator($options['ip']);
        }

        return $this;
    }
1032703
public function setOptionFromArray($options) {
        foreach($options as $option => $value) {
            $this->setOption($option, $value);
        }

        return $this;
    }
897387
public function setOptions(array $options = array())
    {
        if (array_key_exists('messages', $options)) {
            $this->setMessages($options['messages']);
        }

        if (array_key_exists('hostname', $options)) {
            if (array_key_exists('allow', $options)) {
                $this->setHostnameValidator($options['hostname'], $options['allow']);
            } else {
                $this->setHostnameValidator($options['hostname']);
            }
        } elseif ($this->_options['hostname'] == null) {
            $this->setHostnameValidator();
        }

        if (array_key_exists('mx', $options)) {
            $this->setValidateMx($options['mx']);
        }

        if (array_key_exists('deep', $options)) {
            $this->setDeepMxCheck($options['deep']);
        }

        if (array_key_exists('domain', $options)) {
            $this->setDomainCheck($options['domain']);
        }

        return $this;
    }
131116
public static function get($name, $options = [])
    {
        $default = isset($options["default"]) ? $options["default"] : null;

        return isset($_COOKIE[$name]) ? $_COOKIE[$name] : $default;
    }
1362439
protected function createAuthenticationCookie($options) {

        /**
         * @var $db \Joomla\Database\DatabaseDriver
         */
        $db = $this->getContainer()->get('db');

        // L'utilisateur a utilisé un cookie pour se connecter.
        if (isset($options['useCookie']) && $options['useCookie']) {

            $cookieName = $this->getShortHashedUserAgent();

            // On a besoin des anciennes données pour récupérer la série existante.
            $cookieValue = $this->input->cookie->get($cookieName);
            $cookieArray = explode('.', $cookieValue);

            // On filtre la série car on va les utiliser dans la requête.
            $filter = new InputFilter;
            $series = $filter->clean($cookieArray[1], 'ALNUM');

        } elseif (isset($options['remember']) && $options['remember']) { // Ou il a demandé à être reconnu lors sa prochaine connexion.

            $cookieName = $this->getShortHashedUserAgent();

            // On crée une série unique qui sera utilisée pendant la durée de vie du cookie.
            $unique = false;

            do {
                $series  = User::genRandomPassword(20);
                $query   = $db->getQuery(true)
                                    ->select($db->quoteName('series'))
                                    ->from($db->quoteName('#__user_keys'))
                                    ->where($db->quoteName('series') . ' = ' . $db->quote($series));
                $results = $db->setQuery($query)
                                    ->loadResult();

                if (is_null($results)) {
                    $unique = true;
                }

            } while ($unique === false);

        } else { // Sinon, on ne fait rien.

            return false;
        }

        // On récupère les valeurs de la configuration.
        $lifetime = $this->get('cookie.lifetime', '60') * 24 * 60 * 60;
        $length   = $this->get('cookie.key_length', '16');

        // On génère un nouveau cookie.
        $token       = User::genRandomPassword($length);
        $cookieValue = $token . '.' . $series;

        // On écrase le cookie existant avec la nouvelle valeur.
        $this->input->cookie->set($cookieName, $cookieValue, time() + $lifetime, $this->get('cookie.path', '/'), $this->get('cookie.domain'), $this->isSSLConnection());
        $query = $db->getQuery(true);

        if (isset($options['remember']) && $options['remember']) {

            // On crée un nouvel enregistrement.
            $query->insert($db->quoteName('#__user_keys'))
                  ->set($db->quoteName('user_id') . ' = ' . $db->quote($options['user']->username))
                  ->set($db->quoteName('series') . ' = ' . $db->quote($series))
                  ->set($db->quoteName('uastring') . ' = ' . $db->quote($cookieName))
                  ->set($db->quoteName('time') . ' = ' . (time() + $lifetime));
        } else {
            // On met à jour l'enregistrement existant avec le nouveau jeton.
            $query->update($db->quoteName('#__user_keys'))
                  ->where($db->quoteName('user_id') . ' = ' . $db->quote($options['user']->username))
                  ->where($db->quoteName('series') . ' = ' . $db->quote($series))
                  ->where($db->quoteName('uastring') . ' = ' . $db->quote($cookieName));
        }

        $hashed_token = password_hash($token, PASSWORD_BCRYPT);
        $query->set($db->quoteName('token') . ' = ' . $db->quote($hashed_token));
        $db->setQuery($query)
                 ->execute();

        return true;
    }
1200882
public function setOptions(array $options) : self
    {
        $this->_options = array_replace_recursive($this->getDefaultOptions(), $options);

        return $this;
    }
1092667
public function setOptions(array $options = array())
    {
        if (isset($options['image_path'])) {
            $this->_options['image_path'] = $options['image_path'];
        }

        if (isset($options['plugins'])) {
            $this->_options['plugins'] = $options['plugins'];
        }
        return $this;
    }
229803
public function setOptions(array $options)
    {
        foreach ($options as $key => $value) {
            $this->options[$key] = $value;
            $value && $this->object->$key = $value;
        }

        return $this;
    }
867973
public function setOptions(Array $options)
    {
        foreach ($options as $optionName => $optionValue) {
            $this->setTableConfig($optionName, $optionValue);
        }
        return $this;
    }
1191818
public function setOptions(array $options)
    {
        foreach ($options as $key => $value) {
            if (in_array(strtolower($key), $this->_skipOptions)) {
                continue;
            }

            $method = 'set' . ucfirst($key);
            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }

        return $this;
    }
209627
public function options($options)
    {
        foreach ($this->queries as $query) {
            $query->options($options);
        }

        return $this;
    }
1225954
public function addOptions($options)
    {
        if (is_array($this->options)) {
            $this->options = array_merge($this->options, $options);
        } else {
            $this->options = $options;
        }

        return $this;
    }
1225165
public function setCookie($cookies = [])
    {
        $this->cookies = $cookies;
        $this->debug->info(__FUNCTION__, 'setCookie: ', $this->cookies);

        return $this;
    }
380104
public function setTemplateOptions($options)
    {
        $this->areTemplateOptionsFinalized = false;

        if (is_numeric($options)) {
            $options = null;
        } elseif (is_string($options)) {
            $options = json_decode($options, true);
        }

        $this->templateOptions = $options;

        return $this;
    }
844890
public function setOptios($options)
    {
        foreach ($options as $option => $value) {
            $this->setOption($option, $value);
        }
        curl_setopt_array($this->resource, $options);

        return $this;
    }