code换取
@param $code
@return bool|mixed
195477
public function code2session($code){
        if (empty($code)){
            if ($this->business_interface) $this->business_interface->log('code2session code exception');
            return false;
        }
        $url = self::API_CODE2SESSION."appid={$this->config['app_id']}&secret={$this->config['app_secret']}&js_code={$code}&grant_type=authorization_code";
        return $this->curl($url);
    }
731862
private function getHumanResultCode($code)
    {
        if (isset($this->resultCodes[$code])) {
            return $this->resultCodes[$code];
        }

        if (is_scalar($code)) {
            return $code;
        }

        return self::UNKNOWN_CODE;
    }
1278734
public function isCode(int $code) : bool
    {
        return sizeof($this->codes) == 1 && $this->codes[0] == $code;
    }
229956
public static function toMessage($code)
    {
        return isset(self::$message[$code]) ? self::$message[$code] : $code;
    }
999836
public function getMethod($code)
    {
        return isset($this->methods[$code]) ? $this->methods[$code] : null;
    }
15779
public function getAuthorizationCode($code)
    {
        $stmt = $this->db->prepare(sprintf('SELECT * from %s where authorization_code = :code', $this->config['code_table']));
        $stmt->execute(compact('code'));

        if ($code = $stmt->fetch()) {
            // convert date string back to timestamp
            $code['expires'] = strtotime($code['expires']);
        }

        return $code;
    }
487995
private function parse($code)
    {
        try {
            return $this->parser->parse($code);
        } catch (\PhpParser\Error $e) {
            if (\strpos($e->getMessage(), 'unexpected EOF') === false) {
                throw $e;
            }

            // If we got an unexpected EOF, let's try it again with a semicolon.
            return $this->parser->parse($code . ';');
        }
    }
1164953
public static function unserial($code)
    {
        $codeArr = array();

        $codeLines = explode("\n", gzuncompress($code));
        foreach ($codeLines as $line)
            $codeArr[] = str_split($line);

        return $codeArr;
    }
1343239
public static function get($code)
    {
        try {
            return static::getByAlpha2($code);
        } catch (OutOfBoundsException $e) {
            try {
                return static::getByAlpha3($code);
            } catch (OutOfBoundsException $e) {
                try {
                    return static::getByNumeric3($code);
                } catch (OutOfBoundsException $e) {
                    throw new OutOfBoundsException("The code \"{$code}\" is not listed in ISO 4217");
                }
            }
        }
    }
924754
public function validateConfirmationCode($code)
    {
        $ccAttribute = $this->confirmCodeAttribute;
        if (!$ccAttribute || empty($ccAttribute)) {
            return true;
        }
        return $this->$ccAttribute === $code;
    }
1124881
protected function validateCode($code)
    {
        if (is_integer($code)) {
            return true;
        }

        // Plug it back in and see what we get
        if (is_string($code)) {
            return $this->set($code);
        }

        if (is_array($code)) {
            return $this->validateCodeArray($code);
        }

        return false;
    }
147940
public static function check($code, $id = 'sec') 
    {
        $id || $id = 'sec';
        $id = preg_replace("/[^0-9a-z\\-_]/i", '', $id);
        
        isset($_SESSION) || session_start();
    
        // 验证码不能为空
        if(empty($code) || empty($_SESSION[self::SESS_KEY][$id])) {
            return false;
        }
    
        $secode =  $_SESSION[self::SESS_KEY][$id];
        
        // 用过立即清掉，不允许重复使用，防暴力破解
        unset($_SESSION[self::SESS_KEY][$id]);
    
        // session 过期检查
        if(time() > $secode['expire']) {
            return false;
        }
    
        if(strtoupper($code) == strtoupper($secode['code'])) {
            return true;
        }
    
        return false;
    }
661054
public function getLocaleByCode($code)
    {
        $locales = $this->getLocales();
        if (array_key_exists($code, $locales)) {
            return $locales[$code];
        }
    }
235356
public function check($code) {
        $code = trim($code);
        // last token should be ;
        if(substr($code, -1) != ';') {
            $this->error = ['line' => (substr_count($code, "\n") + 1), 'prev' => ']', 'token' => ';', 'must' => true];
            return false;
        }
        // exclude last token
        $code = substr($code, 0, -1);
        // get all tokens
        $tokens = token_get_all($code);
        $prev = false;
        $this->error['line'] = false;
        foreach($tokens as $token) {
            if(is_array($token)) {
                $tn = token_name($token['0']);
                if(in_array($tn, ['T_WHITESPACE', 'T_COMMENT']))
                    continue;
                $this->error = ['line' => $token[2], 'prev' => $prev, 'token' => $tn];
                if(!in_array($tn, self::$valid_tokens))
                    return false;
                elseif($tn == 'T_STRING' && !in_array(strtolower($token[1]), ['true', 'false']))
                    return false;
                if($this->validSequence($prev, $tn))
                   $prev = $tn;
                else
                    return false; 
            } else {
                // line will be defined in any case, so no needed to define it here 
                $this->error['prev'] = $prev;
                $this->error['token'] = $token;
                if(in_array($token, self::$valid_symbols) && $this->validSequence($prev, $token))
                    $prev = $token;
                else
                    return false;
            }
        }
        // chek pairs of $braces
        $braces = 0;
        $inString = 0;
        $this->error['line'] = 0;
        foreach($tokens as $token) {
            if($inString & 1) {
                switch ($token) {
                    case '`':
                    case '"': --$inString; break;
                }
            } else {
                switch ($token) {
                    case '`':
                    case '"': ++$inString; break;
     
                    case '[': case '(': ++$braces; break;
                    case ']': case ')':
                        if ($inString) {
                            --$inString;
                        }
                        else {
                            --$braces;
                            if ($braces < 0) {
                                return false;
                            }
                        }
                    break;
                }
            }
        }
        if ($braces) {
            return false;
        }
        return true;
    }
1298271
public function thirdCallback($code) {
        P($code);
        $encodingAesKey = C("wechat", "encodingAesKey");
        $token          = C("wechat", "token");
        $appId          = C("wechat", "componentAppid");
        $pc             = new WXBizMsgCrypt($token, $encodingAesKey, $appId);
        $format         = file_get_contents('php://input');
        #第三方收到公众号平台发送的消息
        $msg     = "";
        $errCode = $pc->decryptMsg($code['msg_signature'], $code['timestamp'], $code['nonce'], $format, $msg);
        if ($errCode == 0) {
            echo $msg;
        } else {
            echo $errCode;
        }
        exit();
    }
423441
public static function getReasonPhraseByCode($code)
    {
        if (isset(self::$codesDescription[$code])) {
            return self::$codesDescription[$code];
        }

        $group = self::getGroupFromCode($code);

        return self::getReasonPhraseByGroup($group);
    }
490068
public static function getName($code)
    {
        if (!isset(self::$codesDescriptions[$code])) {
            throw new InvalidArgumentException("Invalid code $code specified");
        }

        return self::$codesDescriptions[$code];
    }