ManaPHP\Http\Cookies::set PHP Метод

set() публичный Метод

Sets a cookie to be sent at the end of the request
public set ( string $name, mixed $value, integer $expire, string $path = null, string $domain = null, boolean $secure = false, boolean $httpOnly = true ) : static
$name string
$value mixed
$expire integer
$path string
$domain string
$secure boolean
$httpOnly boolean
Результат static
    public function set($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
    {
        if ($expire) {
            $current = time();
            if ($expire < $current) {
                $expire += $current;
            }
        }
        $cookie = ['expire' => $expire, 'path' => $path, 'domain' => $domain, 'secure' => $secure, 'httpOnly' => $httpOnly];
        if ($name[0] === '!') {
            $name = substr($name, 1);
            $value = $this->_encrypt($value);
        }
        $cookie['name'] = $name;
        $cookie['value'] = $value;
        $this->_cookies[$name] = $cookie;
        $_COOKIE[$name] = $value;
        unset($this->_deletedCookies[$name]);
        return $this;
    }