<commit_before><?php
    class json_web_token
    {
        public $iss;
        public $sub;
        public $aud;
        public $exp;
        public $iat;
        public $custom_claims;
        public $alg;
        public $sign_string;
        /*
        *Decode an encoded JWT string
        *
        *@access public
        *@param mixed $data An encoded JWT string
        *@return a decoded jwt
        */
        public static function decode_jwt($data)
        {
            $rtn_jwt = new json_web_token();
            if(gettype($data) != "string") return $rtn_jwt;        
            $data_array = explode(".",$data);
            //invalid jwt string
            if(count($data_array) != 3) return $rtn_jwt;
            //decode header
            $jwt_header = json_decode(base64_decode($data_array[0]),true);
            foreach ($jwt_header as $key => $value)
                if($key == "alg") $rtn_jwt->alg = $value;                      
            //decode payload
            $rtn_jwt->custom_claims = array();
            $jwt_payload = json_decode(base64_decode($data_array[1]),true);
            foreach ($jwt_payload as $key => $value)
                switch ($key) {
                    case "iss":$rtn_jwt->iss = $value; break;
                    case "sub":$rtn_jwt->sub = $value; break;
                    case "aud":$rtn_jwt->aud = $value; break;
                    case "exp":
                        $rtn_jwt->exp = date_create();
                        date_timestamp_set($rtn_jwt->exp,$value);
                        break;
                    case "iat":
                        $rtn_jwt->iat = date_create();
                        date_timestamp_set($rtn_jwt->iat,$value);
                        break;                    
                    default:$rtn_jwt->custom_claims[$key]=$value;break;<commit_msg>update jwt.php comment<commit_after><?php
    class json_web_token
    {
        public $iss;
        public $sub;
        public $aud;
        public $exp;
        public $iat;
        public $custom_claims;
        public $alg;
        public $sign_string;
        /*
        *Decode an encoded JWT string
        *
        *@access public
        *@param string $data An encoded JWT string
        *@return json_web_token a decoded jwt
        */
        public static function decode_jwt($data)
        {
            $rtn_jwt = new json_web_token();
            if(gettype($data) != "string") return $rtn_jwt;        
            $data_array = explode(".",$data);
            //invalid jwt string
            if(count($data_array) != 3) return $rtn_jwt;
            //decode header
            $jwt_header = json_decode(base64_decode($data_array[0]),true);
            foreach ($jwt_header as $key => $value)
                if($key == "alg") $rtn_jwt->alg = $value;                      
            //decode payload
            $rtn_jwt->custom_claims = array();
            $jwt_payload = json_decode(base64_decode($data_array[1]),true);
            foreach ($jwt_payload as $key => $value)
                switch ($key) {
                    case "iss":$rtn_jwt->iss = $value; break;
                    case "sub":$rtn_jwt->sub = $value; break;
                    case "aud":$rtn_jwt->aud = $value; break;
                    case "exp":
                        $rtn_jwt->exp = date_create();
                        date_timestamp_set($rtn_jwt->exp,$value);
                        break;
                    case "iat":
                        $rtn_jwt->iat = date_create();
                        date_timestamp_set($rtn_jwt->iat,$value);
                        break;                    
                    default:$rtn_jwt->custom_claims[$key]=$value;break;
{'fraction_non_alphanumeric': 0.11785234899328859, 'fraction_numerical': 0.0037583892617449664, 'mean_word_length': 1.3747609942638623, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 27, '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': '7086284', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1039, 'n_words': 218}