<commit_before><?php
    
define("BOOK_CODE_OK",              0);
define("BOOK_CODE_ERR_UNKNOWN",     -10);
define("BOOK_CODE_ERR_FULL",        -11);
define("BOOK_CODE_ERR_INVALID",     -12);
define("BOOK_CODE_ERR_CORRUPT",     -13);

function IS_BOOK_OK($code)
{
    return $code >= BOOK_CODE_OK;
}
    
define("KEY_GUID_TYPE",     "GUID_TYPE");
define("KEY_GUID_VALUE",    "GUID_VAL");

define("TYPE_GUID_PHONE",   1000);
define("TYPE_GUID_WX_ID",   1001);
define("TYPE_GUID_MAX",     TYPE_GUID_WX_ID + 1);

class GuestUID
{
    var $type;       // PHONE, WXID, etc.
    var $val;
    
    function to_array()
    {
        return array(KEY_GUID_TYPE  => $this->type, 
                     KEY_GUID_VALUE => $this->val);
    }
    
    function __construct1($arr)
    {
        if (array_key_exists(KEY_GUID_TYPE, $arr))
        {
            $this->type = $this->valid_type($arr[KEY_GUID_TYPE]);
        }
        
        if (array_key_exists(KEY_GUID_VALUE, $arr))
        {
            $this->val = $arr[KEY_GUID_VALUE];
        }
    }
    
    function __construct2($val, $type)
    {
        $this->type = $this->valid_type($type);
        $this->val = $val;
    }
    
    function valid_type($type)
    {
        if ($type != TYPE_GUID_PHONE && 
            $type != TYPE_GUID_WX_ID)
        {
            return TYPE_GUID_PHONE;
        }
        
        return $type;
    }
    
    function is_valid()
    {
        return (TYPE_GUID_PHONE <= $this->type && $this->type < TYPE_GUID_MAX &&
                is_string($this->val));
    }
}
    
define("KEY_RTICKET_GUID",          "RTICKET_GUID");
define("KEY_RTICKET_NUM",           "RTICKET_NUM");
define("KEY_RTICKET_V_DATE",        "RTICKET_V_DATE");
define("KEY_RTICKET_V_MINS_SLOT",   "RTICKET_V_MINS_SLOT");
class ReservationTicket
{
    var $guid;
    var $num;
    var $visit_date;
    var $visit_mins_slot;
    
    function to_array()
    {
        return array(KEY_RTICKET_GUID           => $this->guid->to_array(),
                     KEY_RTICKET_NUM            => $this->num,
                     KEY_RTICKET_V_DATE         => $this->visit_date,
                     KEY_RTICKET_V_MINS_SLOT    => $this->visit_mins_slot);
    }
    
    function __construct($guid, $num, $v_date, $v_mins_slot)
    {
        $this->guid = $guid;
        $this->num = $num + 0;
        $this->visit_date = $v_date;
        $this->visit_mins_slot = $v_mins_slot;
    }
    
    function is_valid()
    {
        return $this->guid instanceof GuestUID) &&
               is_int($this->num) &&
               is_numeric($this->visit_date) &&
               is_numeric($this->visit_mins_slot);<commit_msg>fix error<commit_after><?php
    
define("BOOK_CODE_OK",              0);
define("BOOK_CODE_ERR_UNKNOWN",     -10);
define("BOOK_CODE_ERR_FULL",        -11);
define("BOOK_CODE_ERR_INVALID",     -12);
define("BOOK_CODE_ERR_CORRUPT",     -13);

function IS_BOOK_OK($code)
{
    return $code >= BOOK_CODE_OK;
}
    
define("KEY_GUID_TYPE",     "GUID_TYPE");
define("KEY_GUID_VALUE",    "GUID_VAL");

define("TYPE_GUID_PHONE",   1000);
define("TYPE_GUID_WX_ID",   1001);
define("TYPE_GUID_MAX",     TYPE_GUID_WX_ID + 1);

class GuestUID
{
    var $type;       // PHONE, WXID, etc.
    var $val;
    
    function to_array()
    {
        return array(KEY_GUID_TYPE  => $this->type, 
                     KEY_GUID_VALUE => $this->val);
    }
    
    function __construct1($arr)
    {
        if (array_key_exists(KEY_GUID_TYPE, $arr))
        {
            $this->type = $this->valid_type($arr[KEY_GUID_TYPE]);
        }
        
        if (array_key_exists(KEY_GUID_VALUE, $arr))
        {
            $this->val = $arr[KEY_GUID_VALUE];
        }
    }
    
    function __construct2($val, $type)
    {
        $this->type = $this->valid_type($type);
        $this->val = $val;
    }
    
    function valid_type($type)
    {
        if ($type != TYPE_GUID_PHONE && 
            $type != TYPE_GUID_WX_ID)
        {
            return TYPE_GUID_PHONE;
        }
        
        return $type;
    }
    
    function is_valid()
    {
        return (TYPE_GUID_PHONE <= $this->type && $this->type < TYPE_GUID_MAX &&
                is_string($this->val));
    }
}
    
define("KEY_RTICKET_GUID",          "RTICKET_GUID");
define("KEY_RTICKET_NUM",           "RTICKET_NUM");
define("KEY_RTICKET_V_DATE",        "RTICKET_V_DATE");
define("KEY_RTICKET_V_MINS_SLOT",   "RTICKET_V_MINS_SLOT");
class ReservationTicket
{
    var $guid;
    var $num;
    var $visit_date;
    var $visit_mins_slot;
    
    function to_array()
    {
        return array(KEY_RTICKET_GUID           => $this->guid->to_array(),
                     KEY_RTICKET_NUM            => $this->num,
                     KEY_RTICKET_V_DATE         => $this->visit_date,
                     KEY_RTICKET_V_MINS_SLOT    => $this->visit_mins_slot);
    }
    
    function __construct($guid, $num, $v_date, $v_mins_slot)
    {
        $this->guid = $guid;
        $this->num = $num + 0;
        $this->visit_date = $v_date;
        $this->visit_mins_slot = $v_mins_slot;
    }
    
    function is_valid()
    {
        return ($this->guid instanceof GuestUID) &&
               is_int($this->num) &&
               is_numeric($this->visit_date) &&
               is_numeric($this->visit_mins_slot);
{'fraction_non_alphanumeric': 0.136731239420726, 'fraction_numerical': 0.007899191273274403, 'mean_word_length': 2.0113250283125708, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6498972', 'n_tokens_mistral': 1920, 'n_tokens_neox': 1919, 'n_words': 266}