验证签名

@param $result
@param $key
@return bool
320596
public function verifySign($result, $key)
    {
        $sign_text = $result['sign'];
        $sign = $this->createSign($result, $key);
        return ($sign == $sign_text);
    }
615969
public function checkDns(&$result)
    {
        if ($this->deepWhois && empty($result['regrinfo']['domain']['nserver'])) {
            $ns = @dns_get_record($this->query['query'], DNS_NS);
            if (!is_array($ns)) {
                return;
            }
            $nserver = array();
            foreach ($ns as $row) {
                $nserver[] = $row['target'];
            }
            if (count($nserver) > 0) {
                $result['regrinfo']['domain']['nserver'] = $this->fixNameServer($nserver);
            }
        }
    }
611843
public function delete(&$result)
    {
        $entity = $this->accessor->getPropertyValue($result, $this->definition->container());
        if (empty($entity)) {
            return $result;
        }

        $this->assertInstance($entity);

        $this->storage->delete($entity, $this->definition->entity())->execute();

        return $result;
    }
1219959
private function _fixResultKeys($result)
    {
        if (!$this->_case || $this->_case === \PDO::CASE_NATURAL) {
            return $result;
        }

        switch($this->_case)
        {
        case \PDO::CASE_LOWER:
            $case = CASE_LOWER;
            break;
        case \PDO::CASE_UPPER:
            $case = CASE_UPPER;
            break;
        default:
            throw new \PDOException('Unknown case attribute: '.$this->_case);
        }

        return array_map(
            function ($item) use ($case) {
                if (is_array($item)) {
                    $item = array_change_key_case($item, $case);
                }
                return $item;
            }, array_change_key_case($result, $case)
        );
    }
628648
protected function hydrateEntity($result)
    {
        $client = new ClientEntity($this->getServer());
        $client->hydrate([
            'id' => $result->id,
            'name' => $result->name,
            'secret' => $result->secret,
            'redirectUri' => (isset($result->redirect_uri) ? $result->redirect_uri : null),
        ]);

        return $client;
    }
842746
protected function _makeResult(array $result) {
        return Result::make($result, $this->getClient())->setModelClass($this->_fullModelClassNamePattern());
    }
217979
protected function prepareAccessTokenResponse(array $result)
    {
        if ($this->getAccessTokenResourceOwnerId() !== null) {
            $result['resource_owner_id'] = $this->getValueByKey(
                $result,
                $this->getAccessTokenResourceOwnerId()
            );
        }
        return $result;
    }
21739
protected function match(ResultInterface $result)/*# : bool */
    {
        $param = $result->getParameters();
        if (isset($param[$this->varname])) {
            $parts = explode($this->seperator, $param[$this->varname]);
            if (count($parts) > 1) {
                return $this->processParts($parts, $result);
            }
        }
        $result->setStatus(Status::BAD_REQUEST);
        return false;
    }
53251
private function parseJson($result)
    {
        $json = json_decode($result, true);
        if (empty($json) || !empty($json['errcode'])) {
            $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
            $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
            return false;
        }
        return $json;
    }
813635
protected function validateResult ($result) : bool
	{
		if (!is_string($result)) return TRUE;
		if (stripos($result, "An error") !== 0) return TRUE;
		$this->error = $result;
		return FALSE;
	}
601969
public function get($key)
    {
        if ($this->type === 1) {
            $return = $this->memcache->get($key);
        } else {
            $return = json_decode($this->memcache->get($this->conf['prefix'] . $key), true);
        }

        is_null($return) && $return = false;
        return $return; //orm层做判断用
    }
211854
public function cache_js_api_ticket($result)
    {
        if (isset($result['errcode']) && $result['errcode'] == 0 && isset($result['ticket']) && $result['ticket'] && isset($result['expires_in']) && $result['expires_in']){
            $expires_in = $result['expires_in'] - 200;
            $expires_in = $expires_in > 0 ? $expires_in : 3600;
            $this->file_cache(self::CACHE_KEY_JS_API_TICKET,$result['ticket'],$expires_in,self::CACHE_PREFIX_ACCESS_TOKEN);
        }
        return true;
    }
1282788
public function delete(string $key)
    {
        //初始化会话
        yield $this->start();

        $data = yield $this->sessionHandler->read($this->sessionId);
        if (!$data) {
            return true;
        }

        $data = json_decode($data, true);
        if (!isset($data[$key])) {
            return true;
        }

        unset($data[$key]);
        return yield $this->sessionHandler->write($this->sessionId, json_encode($data));
    }
471595
public function setResult($jobname, $result = null)
    {
        if (isset($this->results[$jobname])) {
            return false;
        }
        $this->results[$jobname] = $result;
        ++$this->resultsNum;
        $this->checkIfAllReady();
        return true;
    }
719020
public function setResult($key, $result, $ttl)
    {
        if (!($ttl instanceof Ttl)) {
            $ttl = new Ttl($ttl);
        }

        $expirationTimestamp = time() + $ttl->getTtl();
        $value = new Value($result, $expirationTimestamp);

        $this->valueStore->set($key, $value, $ttl->getRealTtl());
    }
849894
public static boolean checkSign(PurchaseInfoResult result, String pubKey) {

        if (result == null || pubKey == null) {
            return false;
        }

        StringBuilder sb = new StringBuilder();

        Map<String, Object> paramsa = new HashMap<String, Object>();
        paramsa.put("pageCount", result.getPageCount());
        paramsa.put("rtnCode", result.getRtnCode());
        sb.append(getNoSign(paramsa, false)).append('&');

        List<PurchaseInfo> purchaseInfos = result.getPurchaseInfoList();
        if (purchaseInfos != null) {
            for (PurchaseInfo info : purchaseInfos) {
                if (info != null) {
                    Map<String, Object> paramsaSub = new HashMap<String, Object>();
                    //必选参数
                    paramsaSub.put("requestId", info.getRequestId());
                    paramsaSub.put("merchantId", info.getMerchantId());
                    paramsaSub.put("appId", info.getAppId());
                    paramsaSub.put("productId", info.getProductId());
                    paramsaSub.put("tradeTime", info.getTradeTime());

                    sb.append(getNoSign(paramsaSub, false)).append('&');
                }
            }
        }

        if (sb.charAt(sb.length()-1) == '&') {
            sb.deleteCharAt(sb.length()-1);
        }

        return doCheck(sb.toString(), result.getSign(), pubKey);
    }
334311
public function MakeSign()
	{
		//签名步骤一：按字典序排序参数
		ksort($this->values);
		$string = $this->ToUrlParams();
		//签名步骤二：在string后加入KEY
		$string = $string . "&key=".WxPayConfig::$KEY;
		//签名步骤三：MD5加密
		$string = md5($string);
		//签名步骤四：所有字符转为大写
		$result = strtoupper($string);
		return $result;
	}