Cake\Database\Expression\TupleComparison::_stringifyValues PHP Method

_stringifyValues() protected method

Returns a string with the values as placeholders in a string to be used for the SQL version of this expression
protected _stringifyValues ( ValueBinder $generator ) : string
$generator Cake\Database\ValueBinder The value binder to convert expressions with.
return string
    protected function _stringifyValues($generator)
    {
        $values = [];
        $parts = $this->getValue();
        if ($parts instanceof ExpressionInterface) {
            return $parts->sql($generator);
        }
        foreach ($parts as $i => $value) {
            if ($value instanceof ExpressionInterface) {
                $values[] = $value->sql($generator);
                continue;
            }
            $type = $this->_type;
            $multiType = is_array($type);
            $isMulti = $this->isMulti();
            $type = $multiType ? $type : str_replace('[]', '', $type);
            $type = $type ?: null;
            if ($isMulti) {
                $bound = [];
                foreach ($value as $k => $val) {
                    $valType = $multiType ? $type[$k] : $type;
                    $bound[] = $this->_bindValue($generator, $val, $valType);
                }
                $values[] = sprintf('(%s)', implode(',', $bound));
                continue;
            }
            $valType = $multiType && isset($type[$i]) ? $type[$i] : $type;
            $values[] = $this->_bindValue($generator, $value, $valType);
        }
        return implode(', ', $values);
    }