public function sendCookie(string $name, ?string $value, int $expire = 0,
        string $path = '/', string $domain = '', bool $secure = false, bool $httpOnly = false): void
    {
        // check name
        if (!preg_match('~^[a-z0-9_\-\.]+$~i', $name)) {
            throw new HttpException("Invalid cookie name '{$name}' given");
        }

        $value = (string) $value;
        if ($expire < 0) {
            $value = '';
        }

        setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
    }
public function sendCookie(string $name, ?string $value, int $expire = 0,
        string $path = '/', string $domain = '', bool $secure = false, bool $httpOnly = false): void
    {
        // check name
        if (!preg_match('~^[a-z0-9_\-\.]+$~i', $name)) {
            throw new HttpException("Invalid cookie name '{$name}' given");
        }

        $value = (string) $value;
        if ($expire < 0) {
            $value = '';
        }

        setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
    }
public function sendCookie ( string $ name , ? string $ value , int $ expire = 0 , string $ path = '/' , string $ domain = '' , bool $ secure = false , bool $ httpOnly = false ) : void { // check name if ( ! preg_match ( '~^[a-z0-9_\-\.]+$~i' , $ name ) ) { throw new HttpException ( "Invalid cookie name '{$name}' given" ) ; } $ value = ( string ) $ value ; if ( $ expire < 0 ) { $ value = '' ; } setcookie ( $ name , $ value , $ expire , $ path , $ domain , $ secure , $ httpOnly ) ; }
Send cookie.
@param  string  $name
@param  ?string $value
@param  int     $expire
@param  string  $path
@param  string  $domain
@param  bool    $secure
@param  bool    $httpOnly
@return void
@throws froq\http\HttpException
Send cookie .