@param ConditionInterface $condition

@return string
482700
protected function aggregate(ConditionInterface $condition)
    {
        if (!$condition->getParameters()) {
            return '';
        }

        $this->aggNumber++;
        $prefix = str_repeat('_', $this->aggNumber);
        $qb = $this->cloneQb($this->queryBuilder);

        $this->resetSqlParts($qb)
            ->select(sprintf('DISTINCT %s%s', $prefix, $this->aliasDotPrimary()))
            ->addGroupBy(sprintf('%s%s', $prefix, $this->aliasDotPrimary()));
        /** @var From $fromPart */
        foreach ($this->getSqlPart($this->queryBuilder, 'from') as $fromPart) {
            /** @var Base $newFrom */
            $newFrom = new From($fromPart->getFrom(), $prefix.$fromPart->getAlias());
            $qb->add('from', $newFrom, true);
        }
        foreach ($this->getSqlPart($this->queryBuilder, 'join') as $rootAlias => $joinPart) {
            /** @var Join $subPart */
            foreach ($joinPart as $subPart) {
                $join = new Join(
                    $subPart->getJoinType(),
                    $prefix.$subPart->getJoin(),
                    $prefix.$subPart->getAlias()
                );
                /** @var Base $newJoin */
                $newJoin = [$prefix.$rootAlias => $join];
                $qb->add('join', $newJoin, true);
            }
        }

        $newParameters = [];
        foreach ($condition->getParameters() as $paramName => $paramValue) {
            $newParameters[str_replace(':', ':'.$prefix, $paramName)] = $paramValue;
        }

        if (count($newParameters) === 2 && stripos($condition->getComparisonOperator(), Condition::BETWEEN) !== false) {
            $newParameterName = implode(' AND ', array_keys($newParameters));
        } else {
            $newParameterName = key($newParameters);
        }

        $qb->andHaving($condition->getSqlFunctionDefinition($newParameterName, $prefix))->setParameters([]);

        foreach ($newParameters as $paramName => $paramValue) {
            $parameter = new Parameter($paramName, $paramValue);
            $this->parameters->add($parameter);
        }

        return sprintf('%s IN(%s)', $this->aliasDotPrimary(), $qb->getDQL());
    }
860404
final protected function parseConditionalLogic($condition)
    {
        if ($condition === null) {
            return null;
        }

        if (is_bool($condition)) {
            return $condition;
        }

        $not = false;
        if (is_string($condition)) {
            $not = ($condition[0] === '!');
            if ($not) {
                $condition = ltrim($condition, '!');
            }
        }

        $result = $this->resolveConditionalLogic($condition);

        return (($not === true) ? !$result : $result);
    }
1205116
public function find_index( $condition ) {
		$index = -1;

		for ( $i = 0, $count = count( $this->elements ); $i < $count; $i++ ) {
			if ( call_user_func( $condition, ($this->at( $i ) ) ) ) {
				$index = $i;
				break;
			}
		}

		return $index;
	}
270452
public function getInputsFromServiceId($conditionServiceId)
    {
        if (!$this->container->has($conditionServiceId)) {
            return false;
        }

        /** @var ConditionInterface $condition */
        $condition = $this->container->get($conditionServiceId);

        return $this->getInputsFromConditionInterface($condition);
    }
864517
protected function formatConditions($entityClass, ConditionsInterface $conditions)
    {
        $rendered = array();
        foreach ($conditions->getConditions() as $attribute => $condition) {
            $rendered[$attribute] = array(
                'ComparisonOperator' => $condition['operator'],
            );
            if (isset($condition['values'])) {
                $rendered[$attribute]['AttributeValueList'] = $this->formatAttributes($entityClass, $condition['values']);
            }
        }
        return $rendered;
    }
1263005
public function parseCondition($condition)
    {
        if (strpos($condition, ':')) {
            $condition = ' ' . substr(strstr($condition, ':'), 1);
        }

        $condition = str_ireplace(array_keys($this->comparison), array_values($this->comparison), $condition);
        $this->tpl->parseVar($condition);

        // $this->tpl->parseVarFunction($condition); // XXX: 此句能解析表达式中用|分隔的函数，但表达式中如果有|、||这样的逻辑运算就产生了歧异
        return $condition;
    }
911251
private function cleanCondition($condition)
    {
        if (is_array($condition)) {
            $condition = array_filter($condition);
            if (empty($condition)) {
                $condition = null;
            }
        }

        return $condition;
    }
1269149
public function validateCondition($condition)
    {
        $is_boolean = true;
        if (!empty($condition)) {
            $encapsuledElements = array();
            preg_match_all(
                KeywordableTraitInterface::GET_BALANCED_BRACKETS,
                $condition,
                $encapsuledElements
            );
            if (count($encapsuledElements[0]) > 0) {
                foreach ($encapsuledElements[0] as $key => $encapsuledElement) {
                    $is_boolean = (preg_match(KeywordableTraitInterface::IS_AND_BOOLEAN, $encapsuledElements[1][$key]) ||
                        preg_match(KeywordableTraitInterface::IS_OR_BOOLEAN, $encapsuledElements[1][$key])) &&
                        $is_boolean;
                    $condition = preg_replace('/'.preg_quote($encapsuledElement).'/', '##', $condition, 1);
                    if (count($encapsuledElements[0]) > 0) {
                        $is_boolean = $is_boolean  && $this->validateCondition($condition);
                    }
                }
            } else {
                $is_boolean = (preg_match(KeywordableTraitInterface::IS_AND_BOOLEAN, $condition) ||
                    preg_match(KeywordableTraitInterface::IS_OR_BOOLEAN, $condition)) &&
                    $is_boolean;
            }
        }

        return $is_boolean;
    }
55623
protected function cleanConditionForTemplate(ConditionCollection $conditions)
    {
        $cleanedConditions = [];
        /** @var $condition ConditionInterface */
        foreach ($conditions as $index => $condition) {
            $temp = [
                'serviceId' => $condition->getServiceId(),
                'index' => $index,
                'name' => $condition->getName(),
                'toolTip' => $condition->getToolTip(),
                'summary' => $condition->getSummary(),
                'validators' => $condition->getValidators()
            ];
            $cleanedConditions[] = $temp;
        }

        return $cleanedConditions;
    }
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;
	}
282628
protected function resolveConditionalLogic($condition)
    {
        if (is_callable([ $this, $condition ])) {
            return !!$this->{$condition}();
        } elseif (is_callable($condition)) {
            return !!$condition();
        } elseif ($this->view()) {
            return !!$this->renderTemplate($condition);
        }

        return !!$condition;
    }
288754
protected function getCount($condition)
    {
        $class = $this->className;
        return $class::find()
            ->select(['id', $this->leftAttribute, $this->rightAttribute, $this->rootAttribute])
            ->where($condition)
            ->count();
    }
603072
public function equals(\Skeleton\Pager\Sql\Condition $condition) {
		if ($this->get_local_field() != $condition->get_local_field()) {
			return false;
		}

		if ($this->get_comparison() == '=' AND $condition->get_comparison() == 'IN') {
			foreach ($condition->get_value() as $value) {
				if (in_array($value, $this->get_value())) {
					return true;
				}
			}
		}

		if ($condition->get_comparison() == '=' AND $this->get_comparison() == 'IN') {
			foreach ($this->get_value() as $value) {
				if (in_array($value, $condition->get_value())) {
					return true;
				}
			}
		}

		if ($this->get_comparison() != $condition->get_comparison()) {
			return false;
		}

		if (!is_array($this->get_value()) and !is_array($condition->get_value())) {
			if ($this->get_value() != $condition->get_value()) {
				return false;
			}
		} elseif (is_array($this->get_value()) and is_array($condition->get_value())) {
			$diff = array_diff($this->get_value(), $condition->get_value());
			if (count($diff) > 0) {
				return false;
			}
		} else {
			return false;
		}

		return true;
	}
318073
protected function parseActionCondition($condition, $action = null, $renderer = null)
    {
        unset($action);

        if ($renderer === null) {
            $renderer = $this->getActionRenderer();
        }

        if (is_bool($condition)) {
            return $condition;
        } elseif (is_string($condition)) {
            $not = ($condition[0] === '!');
            if ($not) {
                $condition = ltrim($condition, '!');
            }

            $result = null;
            if ($renderer && is_callable([ $renderer, $condition ])) {
                $result = !!$renderer->{$condition}();
            } elseif (is_callable([ $this, $condition ])) {
                $result = !!$this->{$condition}();
            } elseif (is_callable($condition)) {
                $result = !!$condition();
            } elseif ($renderer) {
                $result = !!$renderer->renderTemplate($condition);
            }

            if ($result !== null) {
                return $not ? !$result : $result;
            }
        }

        return $condition;
    }
898870
public function compileJoin(string $condition): string
	{
		$parts = $this->parseJoin($condition);
		$count = count($parts['identifiers']);

		// Go through and quote the identifiers
		for($i=0; $i <= $count; $i++)
		{
			if (in_array($parts['combined'][$i], $parts['identifiers']) && ! is_numeric($parts['combined'][$i]))
			{
				$parts['combined'][$i] = $this->db->quoteIdent($parts['combined'][$i]);
			}
		}

		return implode('', $parts['combined']);
	}
232348
public function where($condition) 
    {       
        $this->condition = $condition;
        $this->sql .= ' WHERE ' . $this->buildCondition($condition);
        
        return $this;
    }
872977
protected function checkStatement($condition)
    {
        $condition = '[ '.$condition.' ] && echo "true"';
        $condition = $this->modulable->runRaw($condition);

        return trim($condition) === 'true';
    }