protected function setCookie()
    {
        $cookie = openssl_encrypt(json_encode([
            'expires' => $this->getCookieDuration(),
            'hash'    => $this->getHash(),
            'ip'      => $this->ipAddress() ?? false,
            'agent'   => $this->browserAgent() ?? false
        ]), $this->cipher, $this->secret, false, $this->vector);

        return setcookie($this->cookie, $cookie, $this->getCookieDuration(), COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true);
    }