验证
@param array $args
@param $sign
@return bool
@throws Exception
180343
public function verify(array $args, $sign = null) {
        if (is_null($sign)) {
            $sign = $args[$this->signKey];
        }
        return $this->sign($args) === $sign;
    }
19556
public static function isValid($sign, $messageBody, $token)
    {
        return hash_equals($sign, self::make($messageBody, $token));
    }
1050073
public function handle(Args $args, IO $io)
    {
        $processTitle = $this->config->getProcessTitle();

        $this->warnIfProcessTitleNotSupported($processTitle, $io);

        if ($processTitle && ProcessTitle::isSupported()) {
            ProcessTitle::setProcessTitle($processTitle);

            try {
                $statusCode = $this->doHandle($args, $io);
            } catch (Exception $e) {
                ProcessTitle::resetProcessTitle();

                throw $e;
            }

            ProcessTitle::resetProcessTitle();
        } else {
            $statusCode = $this->doHandle($args, $io);
        }

        // Any empty value is considered a success
        if (!$statusCode) {
            return 0;
        }

        // Anything else is normalized to a valid error status code
        // (i.e. one of [1, 255])
        return min(max((int) $statusCode, 1), 255);
    }
837559
public function getSign(array $para)
    {
        /**
         * a.除sign 字段外，对所有传入参数按照字段名的ASCII 码从小到大排序（字典序）后，
         * 使用URL 键值对的格式（即key1=value1&key2=value2…）拼接成字符串string1，
         * 注意： 值为空的参数不参与签名 ；
         */
        // 过滤不参与签名的参数
        $paraFilter = Helpers::paraFilter($para);
        // 对数组进行（字典序）排序
        $paraFilter = Helpers::argSort($paraFilter);
        // 进行URL键值对的格式拼接成字符串string1
        $string1 = Helpers::createLinkstring($paraFilter);
        /**
         * b.
         * 在string1 最后拼接上key=Key(商户支付密钥 ) 得到stringSignTemp 字符串，
         * 并对stringSignTemp 进行md5 运算，再将得到的字符串所有字符转换为大写，得到sign 值signValue。
         */
        $sign = $string1 . '&key=' . $this->getKey();
        $sign = strtoupper(md5($sign));
        
        return $sign;
    }
1273551
public static function signature($args = [])
	{
		$values = array_map(function ($v) {
			return is_string($v)
				? "'$v'"
				: (is_bool($v)
					? !! $v ? 'true' : 'false'
					: $v);
		}, $args);
		return '(' . implode(', ', $values) . ')';
	}
361675
public function queryOrder(array $args = array()) {
        $args = $this->getQuery()->parameters($this->merge($args))->json();
        if (!array_key_exists('alipay_trade_query_response', $args)) {
            throw new \Exception('未知错误！');
        }
        $args = $args['alipay_trade_query_response'];
        if ($args['code'] != 10000) {
            throw new \Exception($args['msg']);
        }
        if (!$this->verify($args)) {
            throw new \Exception('数据验签失败！');
        }
        return $args;
    }
771226
public function parse($signature)
    {
        $this->setName($signature);

        $argumentsOptions = $this->extractArgumentsOptions($signature);

        foreach ($argumentsOptions as $value) {
            if (substr($value, 0, 2) !== '--') {
                $input = new Argument($value);
            } else {
                $input = new Option(trim($value, '--'));
            }

            $this->command->addInput($input->parse());
        }
    }
854228
public function cannot($args = null)
    {
        $args = is_array($args) ? $args : func_get_args();
        return call_user_func_array([$this->getCurrentAuthority(), 'cannot'], $args);
    }
258632
public function order(array $args = array()) {
        $args = $this->getOrder()->parameters($this->merge($args))->text();
        if ($args['return_code'] != 'SUCCESS') {
            throw new Exception($args['return_msg']);
        }
        if ($args['result_code'] != 'SUCCESS') {
            throw new Exception($args['err_code_des']);
        }
        if (!$this->verify($args)) {
            throw new Exception('数据验签失败！');
        }
        $this->set($args);
        return $args;
    }
151781
public function jsPay(array $args = array()) {
        $args['appId'] = $this->get('appid'); //防止微信返回appid
        $args['nonceStr'] = Str::random(32);
        $args['timeStamp'] = time();
        $data = $this->set($args)->getJsApi();
        $data['package'] = 'prepay_id='.$data['package']['prepay_id'];
        $data['paySign'] = $this->sign($data);
        return $data;
    }
819728
public function warn(
        $msg,
        array $args = array(),
        \Exception $exception = null
    ) {
        return $this->log(\Plop\WARN, $msg, $args, $exception);
    }
144305
public function matchCommand(Args $args)
    {
        $this->args = $args;
        return $this->getTarget($args->getCommand());
    }
317293
public function commit($args = array()) {
        foreach ($args as $item) {
            $res = mysql_query($item, $this->driver);
            if (!$res) {
                throw new \Exception('事务执行失败！');
            }
        }
        $arg = mysql_query('COMMIT');
        $result = empty($arg);
        mysql_query('END', $this->driver);
        return $result;
    }
1166786
public function commit($args = array()) {
		foreach ($args as $item) {
			$this->driver->exec($item);
		}
		return $this->driver->commit();
	}
832467
public function iSubmitTheFormWithId($arg)
    {
        $node = $this->minkContext->getSession()->getPage()->find('css', $arg);
        if ($node) {
            $this->minkContext->getSession()->executeScript("jQuery('$arg').submit();");
        } else {
            throw new \Exception('Element not found');
        }
    }
789614
public function queryRefund(array $args = array()) {
        $args = $this->getQueryRefund()->parameters($this->merge($args))->text();
        if ($args['return_code'] != 'SUCCESS') {
            throw new Exception($args['return_msg']);
        }
        if (!$this->verify($args)) {
            throw new Exception('数据验签失败！');
        }
        return $args;
    }
1177989
public function getSignVeryfy($para_temp, $sign) {
        //除去待签名参数数组中的空值和签名参数
        $para_filter = HelperFunction::paraFilter($para_temp);

        //对待签名参数数组排序
        $para_sort   = HelperFunction::argSort($para_filter);

        //把数组所有元素，按照“参数=参数值”的模式用“&”字符拼接成字符串
        $prestr = HelperFunction::createLinkstring($para_sort);

        $isSgin = false;
        switch (strtoupper(trim($this->sign_type))) {
            case "MD5" :
                $isSgin = HelperFunction::md5Verify($prestr, $sign, $this->key);
                break;
            default :
                $isSgin = false;
        }

        return $isSgin;
    }