<commit_before><?php
    /**
     * Class: Session
     * Handles their session.
     */
    class Session {
        # Variable: $data
        # Caches session data.
        static $data = "";

        # Boolean: $deny
        # Deny this session?
        static $deny = false;

        /**
         * Function: open
         * Decides if the session should be denied.
         */
        static function open() {
            self::$deny = (isset($_SERVER['HTTP_USER_AGENT']) and
                           preg_match("/(bot|crawler|slurp|spider)\b/i", $_SERVER['HTTP_USER_AGENT']));

            return true;
        }

        /**
         * Function: close
         * Returns: @true@
         */
        static function close() {
            return true;
        }

        /**
         * Function: read
         * Reads their session from the database.
         *
         * Parameters:
         *     $id - Session ID.
         */
        static function read($id) {
            self::$data = SQL::current()->select("sessions",
                                                 "data",
                                                 array("id" => $id),
                                                 "id")->fetchColumn();

            // This fallback when self::$data is false return false,
            // but php7.1 need ''
//            return fallback(self::$data, "");
            return self::$data ? self::$data : '';
        }

        /**<commit_msg>Session: strip unnecessary code comments<commit_after><?php
    /**
     * Class: Session
     * Handles their session.
     */
    class Session {
        # Variable: $data
        # Caches session data.
        static $data = "";

        # Boolean: $deny
        # Deny this session?
        static $deny = false;

        /**
         * Function: open
         * Decides if the session should be denied.
         */
        static function open() {
            self::$deny = (isset($_SERVER['HTTP_USER_AGENT']) and
                           preg_match("/(bot|crawler|slurp|spider)\b/i", $_SERVER['HTTP_USER_AGENT']));

            return true;
        }

        /**
         * Function: close
         * Returns: @true@
         */
        static function close() {
            return true;
        }

        /**
         * Function: read
         * Reads their session from the database.
         *
         * Parameters:
         *     $id - Session ID.
         */
        static function read($id) {
            self::$data = SQL::current()->select("sessions",
                                                 "data",
                                                 array("id" => $id),
                                                 "id")->fetchColumn();

            return self::$data ? self::$data : '';
        }

        /**
{'fraction_non_alphanumeric': 0.12419928825622775, 'fraction_numerical': 0.0007117437722419929, 'mean_word_length': 1.0930752047654504, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '89952', 'n_tokens_mistral': 690, 'n_tokens_neox': 687, 'n_words': 167}