yii\sphinx\QueryBuilder::buildOption PHP Метод

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

public buildOption ( array $options, array &$params ) : string
$options array query options in format: optionName => optionValue
$params array the binding parameters to be populated
Результат string the OPTION clause build from [[query]]
    public function buildOption($options, &$params)
    {
        if (empty($options)) {
            return '';
        }
        $optionLines = [];
        foreach ($options as $name => $value) {
            if ($value instanceof Expression) {
                $actualValue = $value->expression;
            } else {
                if (is_array($value)) {
                    $actualValueParts = [];
                    foreach ($value as $key => $valuePart) {
                        if (is_numeric($key)) {
                            $actualValuePart = '';
                        } else {
                            $actualValuePart = $key . ' = ';
                        }
                        if ($valuePart instanceof Expression) {
                            $actualValuePart .= $valuePart->expression;
                        } else {
                            $phName = self::PARAM_PREFIX . count($params);
                            $params[$phName] = $valuePart;
                            $actualValuePart .= $phName;
                        }
                        $actualValueParts[] = $actualValuePart;
                    }
                    $actualValue = '(' . implode(', ', $actualValueParts) . ')';
                } else {
                    $actualValue = self::PARAM_PREFIX . count($params);
                    $params[$actualValue] = $value;
                }
            }
            $optionLines[] = $name . ' = ' . $actualValue;
        }
        return 'OPTION ' . implode(', ', $optionLines);
    }