protected function syncCookies()
    {
        foreach ($this->cookies as $name => $id) {
            if (null === $id) {
                setcookie($name, '', time() - 3600);
            } else {
                setcookie(
                    $name,
                    $id,
                    $this->ttl ? (time() + $this->ttl) : 0,
                    $this->path,
                    $this->domain,
                    $this->secure,
                    $this->httponly
                );
            }
        }
    }