public function setUe(
        string $name,
        string $value,
        int $expires_after = null,
        string $path = null,
        string $domain = null,
        bool $secure = null,
        bool $http_only = null
    ) {
        if (!$name) { // Must have a cookie name!
            throw $this->c::issue('Missing cookie name.');
        }
        $expires_after = max(0, $expires_after ?? 31556926);
        $expires       = $expires_after ? time() + $expires_after : 0;

        $path   = $path ?? '/'; // Entire site.
        $domain = $domain ?? $this->c::currentHost(false);
        $domain = $domain === 'root' ? '.'.$this->c::currentRootHost(false) : $domain;

        $secure    = $secure ?? $this->c::isSsl();
        $http_only = $http_only ?? true;

        if (headers_sent()) {
            throw $this->c::issue('Headers already sent.');
        }
        setcookie($name, $value, $expires, $path, $domain, $secure, $http_only);

        if (mb_stripos($name, '_test_') === false) {
            $_COOKIE[$name] = $value;
        }
    }
public function setUe(
        string $name,
        string $value,
        int $expires_after = null,
        string $path = null,
        string $domain = null,
        bool $secure = null,
        bool $http_only = null
    ) {
        if (!$name) { // Must have a cookie name!
            throw $this->c::issue('Missing cookie name.');
        }
        $expires_after = max(0, $expires_after ?? 31556926);
        $expires       = $expires_after ? time() + $expires_after : 0;

        $path   = $path ?? '/'; // Entire site.
        $domain = $domain ?? $this->c::currentHost(false);
        $domain = $domain === 'root' ? '.'.$this->c::currentRootHost(false) : $domain;

        $secure    = $secure ?? $this->c::isSsl();
        $http_only = $http_only ?? true;

        if (headers_sent()) {
            throw $this->c::issue('Headers already sent.');
        }
        setcookie($name, $value, $expires, $path, $domain, $secure, $http_only);

        if (mb_stripos($name, '_test_') === false) {
            $_COOKIE[$name] = $value;
        }
    }
public function setUe ( string $ name , string $ value , int $ expires_after = null , string $ path = null , string $ domain = null , bool $ secure = null , bool $ http_only = null ) { if ( ! $ name ) { // Must have a cookie name! throw $ this -> c :: issue ( 'Missing cookie name.' ) ; } $ expires_after = max ( 0 , $ expires_after ?? 31556926 ) ; $ expires = $ expires_after ? time ( ) + $ expires_after : 0 ; $ path = $ path ?? '/' ; // Entire site. $ domain = $ domain ?? $ this -> c :: currentHost ( false ) ; $ domain = $ domain === 'root' ? '.' . $ this -> c :: currentRootHost ( false ) : $ domain ; $ secure = $ secure ?? $ this -> c :: isSsl ( ) ; $ http_only = $ http_only ?? true ; if ( headers_sent ( ) ) { throw $ this -> c :: issue ( 'Headers already sent.' ) ; } setcookie ( $ name , $ value , $ expires , $ path , $ domain , $ secure , $ http_only ) ; if ( mb_stripos ( $ name , '_test_' ) === false ) { $ _COOKIE [ $ name ] = $ value ; } }
Sets an unencrypted cookie.

@param string      $name          Name of the cookie.
@param string      $value         Cookie value (empty to delete).
@param int|null    $expires_after Time (in seconds) this cookie should last for.
@param string|null $path          Path to set the cookie for.
@param string|null $domain        Domain name to set the cookie for.
@param bool|null   $secure        Over SSL access only?
@param bool|null   $http_only     HTTP only access?
Sets an unencrypted cookie .