/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Database/Expression
NameSizeModeActions
AggregateExpression.php58400644editdlrm
BetweenExpression.php41460644editdlrm
CaseExpression.php81460644editdlrm
CommonTableExpression.php56600644editdlrm
Comparison.php1890644editdlrm
ComparisonExpression.php95130644editdlrm
FieldInterface.php11850644editdlrm
FieldTrait.php13840644editdlrm
FunctionExpression.php62710644editdlrm
IdentifierExpression.php22220644editdlrm
OrderByExpression.php30150644editdlrm
OrderClauseExpression.php22640644editdlrm
QueryExpression.php299490644editdlrm
TupleComparison.php64630644editdlrm
UnaryExpression.php30490644editdlrm
ValuesExpression.php85680644editdlrm
WindowExpression.php80500644editdlrm
WindowInterface.php46600644editdlrm
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Database/Expression/TupleComparison.php (6463B)
_type = $types; $this->setField($fields); $this->setValue($values); $this->_operator = $conjunction; } /** * Sets the value * * @param mixed $value The value to compare * @return void */ public function setValue($value): void { $this->_value = $value; } /** * Convert the expression into a SQL fragment. * * @param \Cake\Database\ValueBinder $generator Placeholder generator object * @return string */ public function sql(ValueBinder $generator): string { $template = '(%s) %s (%s)'; $fields = []; $originalFields = $this->getField(); if (!is_array($originalFields)) { $originalFields = [$originalFields]; } foreach ($originalFields as $field) { $fields[] = $field instanceof ExpressionInterface ? $field->sql($generator) : $field; } $values = $this->_stringifyValues($generator); $field = implode(', ', $fields); return sprintf($template, $field, $this->_operator, $values); } /** * Returns a string with the values as placeholders in a string to be used * for the SQL version of this expression * * @param \Cake\Database\ValueBinder $generator The value binder to convert expressions with. * @return string */ protected function _stringifyValues(ValueBinder $generator): string { $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; $isMultiOperation = $this->isMulti(); if (empty($type)) { $type = null; } if ($isMultiOperation) { $bound = []; foreach ($value as $k => $val) { /** @var string $valType */ $valType = $type && isset($type[$k]) ? $type[$k] : $type; $bound[] = $this->_bindValue($val, $generator, $valType); } $values[] = sprintf('(%s)', implode(',', $bound)); continue; } /** @var string $valType */ $valType = $type && isset($type[$i]) ? $type[$i] : $type; $values[] = $this->_bindValue($value, $generator, $valType); } return implode(', ', $values); } /** * @inheritDoc */ protected function _bindValue($value, ValueBinder $generator, ?string $type = null): string { $placeholder = $generator->placeholder('tuple'); $generator->bind($placeholder, $value, $type); return $placeholder; } /** * Traverses the tree of expressions stored in this object, visiting first * expressions in the left hand side and then the rest. * * Callback function receives as its only argument an instance of an ExpressionInterface * * @param \Closure $visitor The callable to apply to sub-expressions * @return $this */ public function traverse(Closure $visitor) { /** @var string[] $fields */ $fields = $this->getField(); foreach ($fields as $field) { $this->_traverseValue($field, $visitor); } $value = $this->getValue(); if ($value instanceof ExpressionInterface) { $visitor($value); $value->traverse($visitor); return $this; } foreach ($value as $val) { if ($this->isMulti()) { foreach ($val as $v) { $this->_traverseValue($v, $visitor); } } else { $this->_traverseValue($val, $visitor); } } return $this; } /** * Conditionally executes the callback for the passed value if * it is an ExpressionInterface * * @param mixed $value The value to traverse * @param \Closure $callable The callable to use when traversing * @return void */ protected function _traverseValue($value, Closure $callable): void { if ($value instanceof ExpressionInterface) { $callable($value); $value->traverse($callable); } } /** * Determines if each of the values in this expressions is a tuple in * itself * * @return bool */ public function isMulti(): bool { return in_array(strtolower($this->_operator), ['in', 'not in']); } }