get router by condition
@param array|string $condition
array:
[
'domain' => 'abc.com',
'scheme' => 'https',
]
string:
get by name. same of call getByName()
@return Router |RouterInterface
@throws \InvalidArgumentException
544374
public function get($condition = null): Router
    {
        if (!$condition) {
            return $this->getDefault();
        }

        // alias of getByName()
        if (\is_string($condition)) {
            return $this->getByName($condition);
        }

        $useName = self::DEFAULT_ROUTER;

        foreach ($this->conditions as $name => $cond) {
            if ($this->compareArray($cond, $condition)) {
                $useName = $name;
                break;
            }
        }

        return $this->getByName($useName);
    }
1263033
public function filterOne(array $condition)
	{
		foreach ($condition as $column => $value) {
			$expr = Criteria::expr()->eq($column, $value);
			$this->criteria->andWhere($expr);
		}

		return $this;
	}
1012471
public function fetch($condition = array())
    {
        $query = self::getInstance($this, $condition);

        return $this->getRepository()->fetch($query);
    }
856935
public function filterCondition(array $data, $condition)
    {
        if (empty($condition)) {
            return $data;
        }

        if (!is_array($condition)) {
            throw new InvalidParamException('Condition must be an array');
        }

        if (isset($condition[0])) { // operator format: operator, operand 1, operand 2, ...
            $operator = strtoupper($condition[0]);
            if (isset($this->conditionFilters[$operator])) {
                $method = $this->conditionFilters[$operator];
            } else {
                $method = 'filterSimpleCondition';
            }

            array_shift($condition);

            return $this->$method($data, $operator, $condition);
        } else { // hash format: 'column1' => 'value1', 'column2' => 'value2', ...
            return $this->filterHashCondition($data, $condition);
        }
    }
18257
public static function findAllArray($condition = [],$orderBy = []) {
        return self::find()->where($condition)->asArray()->orderBy($orderBy)->all(static::getDb());
    }
436302
protected function findOne($condition) {
		$condition = $this->alias->encode($condition);
		$model = $this->model->findOne($condition);
		if(empty($model)) {
			throw new NotFoundHttpException(__METHOD__ . ':' . __LINE__);
		}
		return $model;
	}
683639
private function _prepareJoinCondition(array $condition)
	{
		if(count($condition) === 1)
		{
			return $this->condition = '(' . $condition[0]->getColumnName() . ')';
		}

		return $this->condition =
			$condition[0]->getTableName() . '.' . $condition[0]->getColumnName() . ' = ' . $condition[1]->getTableName()
			. '.' . $condition[1]->getColumnName();
	}
1201423
public function createCondition(array $condition): ConditionInterface
    {
        foreach ($this->conditionNameToConditionClassMap as $conditionName => $conditionClass) {
            if (isset($condition[$conditionName])) {
                return new $conditionClass($condition['command'], $condition[$conditionName]);
            }
        }

        throw new ConditionNotFoundException(sprintf('Condition could not be found, available conditions are: %s', implode(', ', $this->conditionNameToConditionClassMap)));
    }
1167655
public function getRouter() : RouterInterface
    {
        if (! $this->router instanceof RouterInterface) {
            $router = new Router();
            $resolver = $this->getCallbackResolver();
            if ($resolver instanceof CallbackResolverInterface) {
                $router->setCallbackResolver($resolver);
            }

            $routerCacheFile = $this->getConfiguration('routerCacheFile', false);
            if ($routerCacheFile) {
                $router->setCacheFile($routerCacheFile);
            }

            $this->router = $router;
        }

        return $this->router;
    }
641414
protected function interpretDeleteCondition($condition)
    {
        // Allow pipe symbol to split strategies
        if (false !== strpos($condition, '|')) {
            $condition = explode('|', $condition);
        }

        // Normalize arrays, handle each string condition separately
        if (is_array($condition)) {

            $normalized = [];

            foreach ($condition as $partialCondition) {
                $normalized = array_merge($normalized, $this->interpretDeleteCondition($partialCondition));
            }

            return $normalized;
        }

        // Split strategy & parameters
        if (false !== strpos($condition, ':')) {
            list($strategy, $parameters) = explode(':', $condition, 2);
            $parameters = explode(',', $parameters);
        } else {
            $strategy   = $condition;
            $parameters = [];
        }

        /** @var string $strategy */
        return [ $strategy => $parameters ];
    }
126662
static public function router($rule='',$tag='')
    {

        if($rule && $tag){
            return self::make(\linkphp\router\Router::class)->rule($rule,$tag);
        }

        return self::make(\linkphp\router\Router::class);
    }
913307
private function parseCondition($condition, $parameters = [])
	{
		if (strpos($condition, ' ')) {
			$match = preg_match('~^
				(.+)\s                          ## identifier 
				(
					(?:\$\w+) |                 ## $mongoOperator
					(?:[A-Z]+(?:_[A-Z]+)*) |    ## NAMED_OPERATOR or 
					(?:[\<\>\!]?\=|\>|\<\>?)    ## logical operator
				)	
				(?:
					\s%(\w+(?:\[\])?) |         ## modifier or
					\s(.+)                      ## value
				)?$~xs', $condition, $cond);

			//['cond IN' => [...]], ['cond = %s' => 'param'], ['cond $gt' => 20]
			if (!empty($match)) {

				if (substr($cond[1], 0, 1) === $this->cmd) {
					throw new InvalidArgumentException("Field name cannot start with '{$this->cmd}'");
				}

				if ($parameters === [] && !isset($cond[4])) {
					throw new InvalidArgumentException("Missing value for item '{$cond[1]}'");
				}

				return $this->formatCondition($cond[1], trim($cond[2], $this->cmd), isset($cond[4]) ? $cond[4] : $parameters, isset($cond[3]) ? $cond[3] : NULL);
			}
		}

		if ($parameters === []) {
			throw new InvalidArgumentException("Missing value for item '{$condition}'");
		}

		if (is_array($parameters) && ($value = reset($parameters))) {

			//['$cond' => $param[]]
			if (substr($condition, 0, 1) === $this->cmd) {
				return [$condition => $this->parseDeepCondition($parameters, TRUE)];
			}
			//['cond' => ['param', ...]]
			if (substr($key = key($parameters), 0, 1) !== $this->cmd) {
				return $this->formatCondition($condition, 'IN', $parameters);
			}
			//['cond' => ['$param' => [...]]]
			if (is_array($value)) {
				return [$condition => [$key => $this->parseDeepCondition($value)]];
			}
		}

		// [cond => param]
		return [$condition => $parameters];
	}
356929
public function id(array $condition)
    {
        $user_id = $this->user->getId();
        return $this->compare($user_id, $condition['value'], $condition['operator']);
    }
978799
public function possible($condition) {
      $query = $this->buildStrategyCondition($condition, Possible::create());
      return $this->process($query);
    }
741070
protected function getCondition($condition,$model){
        if(empty($condition)){
            return $condition;
        }
        if(is_array($condition)){
            foreach ($condition as $k=>$v){
                $result[$k]=$this->getCondition($v,$model);
            }
        }else{
            if(preg_match('/{([\w\d_]+):([\w\d_]+)}/',$condition,$match)){
                $result=$model->{$match[2]};
            }else{
                $result=$condition;
            }
        }
        return $result;
    }
386770
public function getCart(array $conditions = array())
    {
        $conditions += array(
            'user_id' => $this->cart_uid,
            'store_id' => $this->store_id
        );

        $cart = $this->cart->getContent($conditions);
        $this->prepareCart($cart);
        return $cart;
    }
795126
protected function joinCondition(array $condition): string
	{
		return $this->column($condition['column1']) . ' ' . $condition['operator'] . ' ' . $this->column($condition['column2']);
	}