字段名分析
@access public
@param  Query  $query    查询对象
@param  mixed  $key      字段名
@param  bool   $strict   严格检测
@return string
967827
public function parseKey(Query $query, $key, $strict = false)
    {
        return $key instanceof Expression ? $key->getValue() : $key;
    }
207602
private static function encodeQueryParts($query)
    {
        $queryParts = explode('&', $query);
        $queryArray = [];

        foreach ($queryParts as $queryPart) {
            $pieces = explode('=', $queryPart, 2);

            $key = rawurlencode($pieces[0]);
            $value = rawurlencode($pieces[1]);

            $queryArray[$key][] = $value;
        }
        return $queryArray;
    }
625852
function parse_query($query) {
		$operations = array('SELECT','INSERT','UPDATE','DELETE','REPLACE','RENAME','SHOW','SET','DROP','CREATE INDEX','CREATE TABLE','EXPLAIN','DESCRIBE');

		$query_ex = '/(?P<operation>'.implode("|",$operations).')\s*(?P<columns>.?)\s*(FROM|INTO)\s*(?P<table>`?.*?`?)\s*(WHERE)?\s*?(?P<where>.*?)\s*?(ORDER BY)?\s*?(?P<order>.*?)?\s*?(LIMIT)?(?P<limit>.*?)?$/i';
		preg_match($query_ex, $query, $retn);
		return $retn;	
    }
1086497
protected function queryString($key = null, $default = null, $deep = false)
    {
        return $key === null ? $this->getQueryString()->all() : $this->getQueryString()->get($key, $default, $deep);
    }
1128592
public function match($query)
    {
        $ruleParts  = explode('/', $this->rule);
        $queryParts = explode('/', $query);

        $ruleCount = count($ruleParts);
        //$querCount = count($queryParts);
        
        $match = false;
        for ($i = 0; $i < $ruleCount; $i++) {
            $rp = $ruleParts[$i];
            $qp = isset($queryParts[$i]) ? $queryParts[$i] : null;
            
            $first = isset($rp[0]) ? $rp[0] : '';
            switch ($first) {
                case '*':
                    $match = true;
                    break;
                
                default:
                    $match = ($rp == $qp);
                    break;
            }
            
            if (!$match) {
                return false;
            }
        }
        
        //echo "$this->rule == $query\n";
        return true;
    }
737349
protected function parseLimit(Query $query, $limit)
    {
        return (!empty($limit) && false === strpos($limit, '(')) ? ' LIMIT ' . $limit . ' ' : '';
    }
952416
public static function confirm( $question, $strict = false ) 
	{
		$question .= ' [yes/no]: ';
		
		if ( $strict ) 
		{
			do 
			{
				$res = strtolower( static::read( $question ) );
			} 
			while ( $res !== 'yes' && $res !== 'no' );
			
			return ( $res == 'yes' ) ? true : false;
		}
		
		do 
		{
			$res = strtolower( static::read( $question ) );
		} 
		while ( empty( $res ) );
		
		$positives = array(
			'yes', 'y', 'ya', 'ye', 'yeah', 'yup',
			'jep', 'jap', 'ja', 
			'si', 'sim',
			'true',
			'hai',
			'oui',
			'no problemo',
		);
		
		return in_array( $res, $positives );
	}
438055
public function scopeByName($query, $name, $strict = false)
    {
        $names = (array) $name;

        if (! $strict && $name !== '*') {
            $names[] = '*';
        }

        $query->whereIn("{$this->table}.name", $names);
    }
727999
protected static function normalizeQuery(?string $query): ?string
    {
        if (null === $query) {
            return null;
        }

        if ('' === $query) {
            return '';
        }

        $parts = [];
        $order = [];

        // sort query params by key and remove missing keys
        foreach (explode('&', $query) as $param) {
            if ('' === $param || '=' === $param[0]) {
                continue;
            }
            $parts[] = $param;
            $kvp = explode('=', $param, 2);
            $order[] = $kvp[0];
        }

        array_multisort($order, SORT_ASC, $parts);

        return parent::normalizeQuery(implode('&', $parts));
    }
438525
public function forever($key, $value, $strict = true) {
        return $this->set($key, $value, 0, $strict);
    }
829787
public function has($key, $strict = false)
    {
        // When $strict is true, he check $key not how a key but a value.
        $isset = isset($this->storage[$key]);

        if ($isset) {
            if ($strict === true) {
                $isset = $isset && !empty($this->storage[$key]);
            }
        }

        return $isset;
    }
794805
function strict(query) {
  return foldl(function(acc, val, key) {
    if (has.call(allowedKeys, key)) acc[key] = val;
    return acc;
  }, {}, utm(query));
}
775498
public function scopeKey(Illuminate\Database\Query\Builder $query, $key)
    {
        return $query->whereKey($key);
    }
1166090
public static function parseUrlQuery($query)
    {
        $result = [];
        $pairs = explode('&', $query);
        foreach ($pairs as $pair) {
            $parts = explode('=', $pair);
            $rawKey = $parts[0];
            $rawValue = isset($parts[1]) ? $parts[1] : '';
            $value = urldecode($rawValue);
            $key = strtr(urldecode($rawKey), ['[' => '.', ']' => '']);
            Arr::set($result, $key, $value);
        }
        return $result;
    }
959084
protected function parseTerm($query)
    {
        $query = $this->escape($query);

        $match = preg_match("/([^>=|<=|!=|>|<|=|\*=)]*)(>=|<=|!=|>|<|=|\*=)(.*)/", $query, $matches);

        if ($match) {
            $term = array();
            $term['property'] = trim($matches[1]);
            $term['operator'] = trim($matches[2]);
            $term['value'] = $this->decode(trim(($matches[3])));

            return $term;
        }

        return false;
    }
939329
protected function _filterQuery($query)
    {
        if (! empty($query) && strpos($query, '?') === 0) {
            $query = substr($query, 1);
        }

        $parts = explode('&', $query);
        foreach ($parts as $index => $part) {
            list($key, $value) = $this->_splitQueryValue($part);
            if ($value === null) {
                $parts[$index] = $this->_filterQueryOrFragment($key);
                continue;
            }
            $parts[$index] = sprintf(
                '%s=%s',
                $this->_filterQueryOrFragment($key),
                $this->_filterQueryOrFragment($value)
            );
        }

        return implode('&', $parts);
    }
132321
public function keys($search = null, $strict = null)
    {
        if (null === $search && null === $strict) {
            $keys = \array_keys($this->items);
        } elseif (null !== $search && null === $strict) {
            $keys = \array_keys($this->items, $search);
        } else {
            $keys = \array_keys($this->items, $search, $strict);
        }

        return new static($keys);
    }