获取微信卡券签名
@param array $arrdata 签名数组
@param string $method 签名方法
@return bool|string 签名值
181870
public function getTicketSignature($arrdata, $method = "sha1")
    {
        if (!function_exists($method)) {
            return false;
        }
        $newArray = array();
        foreach ($arrdata as $value) {
            array_push($newArray, (string)$value);
        }
        sort($newArray, SORT_STRING);
        return $method(implode($newArray));
    }
927121
public function getName($name = null, $domain = null, $method = '*')
    {
        return Zilf::$container->getShare('ruleName')->get($name, $domain, $method);
    }
527528
private function filterArray($arrData, $arrFilters) {
		// Normalize the filter array (['filter' => FILTER, ...])
		foreach ($arrFilters as $key => &$F) {
			if (is_int($F))
				$F = array('filter' => $F);

			elseif (!isset($F['filter'])) {
				unset($arrFilters[$key]);
				continue;

			} elseif (is_string($F['filter'])) {
				try {
					$intF = @constant($F['filter']);
				} catch (\Exception $e) {
					continue;
				}
				if ( $intF )
					$F['filter'] = $intF;
				else {
					continue;

				}
			} elseif (isset($F['required'])) {
				if (!$F['required'] && (string)$arrData[$key] == '') {
					unset($arrFilters[$key]);
					continue;
				}
			}

			$F['value'] = isset($arrData[$key]) ? $arrData[$key] : null;
			if (!isset($F['field']))
				$F['field'] = $key;
		}

		$arrCallbacks = array();
		$arrValidators = array();

		// Remove callback functions from the filter array and allocate them to the callback array
		foreach ($arrFilters as $key => $filter) {
			if (isset($this->filters[$filter['filter']])) {
				$arrValidators[$key] = $filter + $this->filters[$filter['filter']];
				$arrValidators[$key]['filter'] = $this->filters[$filter['filter']]['filter'];
			} elseif (isset($this->callbacks[$filter['filter']]))
				$arrCallbacks[$key] = $filter;
			else
				$arrValidators[$key] = $filter;
		}

		$validate = array();

		// Validate the callbacks
		foreach ($arrCallbacks as $key => $filter)
			$validate[$key] = call_user_func($this->callbacks[$filter['filter']], $filter);

		// Validate through PHP filter function
		$validate = $validate + filter_var_array($arrData, $arrValidators);

		// Check the results
		$res = array();
		foreach ($arrFilters as $key => $filter) {
			$result = isset($validate[$key]) ? $validate[$key] : null;
			if (is_null($result) || ($filter != FILTER_VALIDATE_BOOLEAN && (bool) $result == false))
				$res[$key] = $filter;
		}

		return $res;
	}
472405
private function checkRelationship($method)
    {
        $table = $this->table;

        $one = $table->getOneRelationship();
        $many = $table->getManyRelationship();
        $belongsTo = $table->getBelongsToRelationship();

        $type = null;
        $params = null;

        if (!is_null($one) && array_key_exists($method, $one)) {
            $type = 'one';
            $params = $one[$method];
        }

        if (!is_null($many) && array_key_exists($method, $many)) {
            $type = 'many';
            $params = $many[$method];
        }

        if (!is_null($belongsTo) && array_key_exists($method, $belongsTo)) {
            $type = 'belongsTo';
            $params = $belongsTo[$method];
        }

        if (is_null($type)) {
            return false;
        }

        return $this->parseRelationship($table, $type, $params);
    }
1269201
function reflection_getMethodInfo($method_name)
    {
        /** http://www.flickr.com/services/api/flickr.reflection.getMethodInfo.html */
        $this->request("flickr.reflection.getMethodInfo", array("method_name" => $method_name));
        return $this->parsed_response ? $this->parsed_response : false;
    }
934491
public static function findFieldClass($method)
    {
        // If alias exists.
        if (isset(static::$fieldAlias[$method])) {
            $method = static::$fieldAlias[$method];
        }

        $class = Arr::get(static::$availableFields, $method);

        if (class_exists($class)) {
            return $class;
        }

        return false;
    }
838468
public function call($method)
    {
        $args = func_get_args();
        $data = call_user_func_array(array($this->_jiraClient, 'call'), $args);
        return $this->returnObjectArray($data, '\Jira\Remote\RemoteProject', 'key');
    }
1352350
public function getCacheKey($method, $args = null)
    {

        $request = app('Illuminate\Http\Request');
        $args = serialize($args);
        $criteria = $this->serializeCriteria();
        $key = sprintf('%s@%s-%s', get_called_class(), $method, md5($args . $criteria . $request->fullUrl()));

        CacheKeys::putKey(get_called_class(), $key);

        return $key;

    }
619058
final public function methodDefined($method) {
		$name = get_class($this);

		/**
		 * TODO: FIX ISSUE DETERMINE IF A FUNCTION EXISTS OR NOT for Platform_XXX_Platform
		 */
		//if the class name is the abstract class then return false
		$abstractClassNames = array('JFusion\Plugin\Admin',
			'JFusion\Plugin\Auth',
			'JFusion\Plugin\Front',
			'JFusion\Plugin\User',
			'JFusion\Plugin\Plugin');
		$return = false;
		if (!in_array($name, $abstractClassNames)) {
			try {
				$m = new ReflectionMethod($this, $method);
				$classname = $m->getDeclaringClass()->getName();
				if ($classname == $name || !in_array($classname, $abstractClassNames)) {
					$return = true;
				}
			} catch (Exception $e) {
				$return = false;
			}
		}
		return $return;
	}
989530
public function RPCall($method, $args)
    {
        if (!is_callable($f = [$this->pool, 'RPCall'])) {
            return false;
        }
        return $f($method, $args);
    }
1227185
public function match($uri, $method){

        foreach($this->routes as $route){
            if($route->match($uri, $method)){ //调用每个对象Route查询是非匹配
                return $route;
            }
        }
        //没有找到匹配的路由
        return false;
    }
1064466
protected function getApiUrl($method) {
    static $READ_ONLY_CALLS =
      array('admin.getallocation' => 1,
            'admin.getappproperties' => 1,
            'admin.getbannedusers' => 1,
            'admin.getlivestreamvialink' => 1,
            'admin.getmetrics' => 1,
            'admin.getrestrictioninfo' => 1,
            'application.getpublicinfo' => 1,
            'auth.getapppublickey' => 1,
            'auth.getsession' => 1,
            'auth.getsignedpublicsessiondata' => 1,
            'comments.get' => 1,
            'connect.getunconnectedfriendscount' => 1,
            'dashboard.getactivity' => 1,
            'dashboard.getcount' => 1,
            'dashboard.getglobalnews' => 1,
            'dashboard.getnews' => 1,
            'dashboard.multigetcount' => 1,
            'dashboard.multigetnews' => 1,
            'data.getcookies' => 1,
            'events.get' => 1,
            'events.getmembers' => 1,
            'fbml.getcustomtags' => 1,
            'feed.getappfriendstories' => 1,
            'feed.getregisteredtemplatebundlebyid' => 1,
            'feed.getregisteredtemplatebundles' => 1,
            'fql.multiquery' => 1,
            'fql.query' => 1,
            'friends.arefriends' => 1,
            'friends.get' => 1,
            'friends.getappusers' => 1,
            'friends.getlists' => 1,
            'friends.getmutualfriends' => 1,
            'gifts.get' => 1,
            'groups.get' => 1,
            'groups.getmembers' => 1,
            'intl.gettranslations' => 1,
            'links.get' => 1,
            'notes.get' => 1,
            'notifications.get' => 1,
            'pages.getinfo' => 1,
            'pages.isadmin' => 1,
            'pages.isappadded' => 1,
            'pages.isfan' => 1,
            'permissions.checkavailableapiaccess' => 1,
            'permissions.checkgrantedapiaccess' => 1,
            'photos.get' => 1,
            'photos.getalbums' => 1,
            'photos.gettags' => 1,
            'profile.getinfo' => 1,
            'profile.getinfooptions' => 1,
            'stream.get' => 1,
            'stream.getcomments' => 1,
            'stream.getfilters' => 1,
            'users.getinfo' => 1,
            'users.getloggedinuser' => 1,
            'users.getstandardinfo' => 1,
            'users.hasapppermission' => 1,
            'users.isappuser' => 1,
            'users.isverified' => 1,
            'video.getuploadlimits' => 1);
    $name = 'api';
    if (isset($READ_ONLY_CALLS[strtolower($method)])) {
      $name = 'api_read';
    } else if (strtolower($method) == 'video.upload') {
      $name = 'api_video';
    }
    return self::getUrl($name, 'restserver.php');
  }
1034035
protected function fetchDefaultCacheRecord($method, $args)
    {
        // Instead of using has() we directly implement the value getter
        // to avoid additional cache hits if the key exists.
        if (is_null($value = parent::get($args['key']))) {
            $this->checkReservedKeyPattern($args['key']);

            call_user_func_array([$this, 'storeKeywords'], array_only($args, ['key', 'minutes', 'keywords']));

            $this->setKeywordsOperation(true);

            $value = call_user_func_array(['parent', $method], array_values($args));

            $this->setKeywordsOperation(false);
        }

        if (! $this->operatingOnKeywords()) {
            $this->resetCurrentKeywords();
        }

        return $value;
    }
821923
private function magicWhere($method, $args)
    {
        $whereStatement = explode('_', $method);

        // Get where
        if (count($whereStatement) == 2) {
            return $this->getWhere($args[0], '=', $args[1]);
        }

        $operators = [
            'in', 'between', 'like', 'null',
            'not',
            'first', 'last',
            'many',
        ];

        // If an operator is found then add operators.
        if (array_intersect($whereStatement, $operators)) {
            list($operator, $firstOrLast, $inverse) = $this->determineMagicWhereDetails($whereStatement);

            $column = $args[0];
            $value  = (isset($args[1]) ? $args[1] : null);

            return $this->getWhere(
                $column,
                $operator,
                $value,
                $inverse,
                $firstOrLast
            );
        }
    }
69662
public function exec($modName, $method, $args)
    {
        $postData = $this->buildRpcReq($modName, $method, $args);

        $options = [
            CURLOPT_URL             => $this->host,
            CURLOPT_CUSTOMREQUEST   => 'POST', //请求类型 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'
            CURLOPT_POST            => true, //发送一个常规的post请求
            CURLOPT_RETURNTRANSFER  => true, //TRUE 将curl_exec()获取的信息以字符串返回，而不是直接输出
            CURLOPT_HEADER          => false, //启用时会将头文件的信息作为数据流输出。
            CURLOPT_CONNECTTIMEOUT  => 2, //在尝试连接时等待的秒数，(CURLOPT_CONNECTTIMEOUT_MS :以毫秒为单位)
            CURLOPT_TIMEOUT         => 2, //允许 cURL 函数执行的最长秒数
            CURLOPT_HTTPHEADER      => [ //header
                'User-Agent: ' . $this->userAgent,
            ],
            CURLOPT_POSTFIELDS      => http_build_query($postData), //这种方式强制采用 application/x-www-form-urlencoded
            CURLOPT_IPRESOLVE       => CURL_IPRESOLVE_V4, //允许程序选择想要解析的 IP 地址类别: ipv4
            //https不验证证书
            // CURLOPT_SSL_VERIFYHOST  => 0,
            // CURLOPT_SSL_VERIFYPEER  => false,
            // CURLOPT_HTTP_VERSION    => CURL_HTTP_VERSION_2_0, //强制使用 HTTP/2.0
        ];

        $ch = curl_init();
        curl_setopt_array($ch, $options);
        $response = curl_exec($ch);

        $errno = curl_errno($ch);
        if ($errno > 0) {
            $error = sprintf("curl error=%s, errno=%d.", curl_error($ch), $errno);
            curl_close($ch);
            throw new Exception($error);
        }

        //$curl_info 包含信息包括:url, content_type, http_code, header_size, request_size, total_time
        $curlInfo = curl_getinfo($ch);
        curl_close($ch);

        //$totalTime = $curlInfo['total_time'];
        if ($curlInfo['http_code'] != 200) {
            throw new Exception('rpc请求失败, http_code: ' . $curlInfo['http_code'] . ', response: ' . $response);
        }

        $data = json_decode($response, true);
        if (json_last_error() !== JSON_ERROR_NONE || ! is_array($data) || ! isset($data['code'])) {
            throw new Exception('rpc返回值非法, response: ' . $response);
        }

        if (0 === $data['code']) {
            return $data['data'];
        } else {
            throw new Exception('rpc返回值非法, code不为0, error msg: ' . $data['error']);
        }
    }
994375
public function setRoute($method, $args)
    {
        $pattern = array_shift($args);
        $callable = array_pop($args);

        //包含额外的参数
        if (count($args) > 0) {
            //额外的参数为单独的调用中间件
            foreach ($args as $call) {
                if (!is_callable($call)) {
                    continue;
                }
                $this->invoke($pattern, $call);
            }
        }
        $this->route->register($method, $pattern, $callable);
    }
1157443
protected function callTraitMethod($method, array $args=[])
    {
        if (method_exists($this, $method)) {
            return call_user_func([$this, $method], ...$args);
        }
        return null;
    }