yii\sphinx\MatchBuilder::buildAndMatch PHP Метод

buildAndMatch() публичный Метод

Connects two or more MATCH expressions with the AND or OR operator
public buildAndMatch ( string $operator, array $operands, array &$params ) : string
$operator string the operator which is used for connecting the given operands
$operands array the Match expressions to connect
$params array the expression parameters to be populated
Результат string the MATCH expression
    public function buildAndMatch($operator, $operands, &$params)
    {
        $parts = [];
        foreach ($operands as $operand) {
            if (is_array($operand) || is_object($operand)) {
                $operand = $this->buildMatch($operand, $params);
            }
            if ($operand !== '') {
                $parts[] = $operand;
            }
        }
        if (empty($parts)) {
            return '';
        }
        return '(' . implode(')' . ($operator === 'OR' ? ' | ' : ' ') . '(', $parts) . ')';
    }