public static function update($clear = false)
    {
        global $user;
        static $count = 0;
        $count++;

        if ($clear || !($_SESSION['id'] ?? false)) {
            Serialized::clear();
        }

        if (!\is_array($user)) {
            $user = array();
        }

        if (static::$user_id = $_SESSION['id'] = $_SESSION['id'] ?? false) {
            $_SESSION['X_PJAX_Version'] = 'v' . SITE_VERSION . 'u' . $_SESSION['id'];
        } // force reload occurs when X_PJAX_Version changes between requests

        if (!isset($_SESSION['X_PJAX_Version'])) {
            $_SESSION['X_PJAX_Version'] = SITE_VERSION;     // static::$user_id, keep this static
        }

        Request::setHeader('X-PJAX-Version: ' . $_SESSION['X_PJAX_Version']);

        /* If the session variable changes from the constant we will
         * send the full html page and notify the pjax js to reload
         * everything
         * */

        if (\is_callable(self::$callback)) {
            /** @noinspection OnlyWritesOnParameterInspection */
            ($lambda = self::$callback)($clear);    // you must have callable in a variable in fn scope
        }
        if (!\defined('X_PJAX_VERSION')) {
            \define('X_PJAX_VERSION', $_SESSION['X_PJAX_Version']);
        }
        Request::sendHeaders();  // Send any stored headers
    }