Converts the expression to its string representation

@param \Cake\Database\ValueBinder $generator Placeholder generator object
@return string
499018
public function sql(ValueBinder $generator)
    {
        $operand = $this->_value;
        if ($operand instanceof ExpressionInterface) {
            $operand = $operand->sql($generator);
        }

        if ($this->_mode === self::POSTFIX) {
            return '(' . $operand . ') ' . $this->_operator;
        }

        return $this->_operator . ' (' . $operand . ')';
    }
1213397
public function renderValueReader($property): string
    {
        if ($property instanceof VirtualPropertyMetadata) {
            $accessor = \sprintf('$object->%s()', $property->name);
        } elseif (null !== $property->getter) {
            $accessor = \sprintf('$object->%s()', $property->getter);
        } elseif ($property->reflection->isPublic()) {
            $accessor = \sprintf('$object->%s', $property->name);
        } else {
            $accessor = \sprintf('$this->classMetadata->propertyMetadata[\'%s\']->reflection->getValue($object)', $property->name);
        }

        return \strtr(self::$propertyReadTemplate, [
            '{propertyName}' => $property->name,
            '{accessor}' => $accessor,
            '{exposure}' => $this->createValueExposure($property),
        ]);
    }
912598
public function sql(ValueBinder $generator)
    {
        $order = [];
        foreach ($this->_conditions as $k => $direction) {
            if ($direction instanceof ExpressionInterface) {
                $direction = $direction->sql($generator);
            }
            $order[] = is_numeric($k) ? $direction : sprintf('%s %s', $k, $direction);
        }

        return sprintf('ORDER BY %s', implode(', ', $order));
    }
24412
private function getReplaceStatement($usePlaceholders = true)
    {
        $statement = "";

        if (!$this->isReplace()) {
            return $statement;
        }

        $statement .= $this->getReplaceString();

        if ($this->isInto) {
            $statement .= " " . $this->getIntoString($usePlaceholders);
        } else {
            if ($this->set) {
                $statement .= " " . $this->getSetString($usePlaceholders);
            }
        }

        return $statement;
    }
427712
public function placeholder()
    {
        if ($this->placeholder === null) {
            $metadata = $this->metadata();

            if (isset($metadata['data']['placeholder'])) {
                $this->setPlaceholder($metadata['data']['placeholder']);
            } else {
                $this->placeholder = '';
            }
        }

        if ($this->placeholder instanceof Translation) {
            if (isset($this->placeholder->isRendered) && $this->placeholder->isRendered === false) {
                $this->placeholder = $this->renderTranslatableTemplate($this->placeholder);
            }

            if ($this->lang()) {
                return $this->placeholder[$this->lang()];
            }
        }

        return $this->placeholder;
    }
1258463
protected function _getPlaceholder($placeholder = null)
    {
        $ret = $this->_getSetting('placeholder');
        if ($placeholder) {
            return $this->getData()->trlStaticExecute($ret[$placeholder]);
        }
        foreach ($ret as $k => $v) {
            $ret[$k] = $this->getData()->trlStaticExecute($v);
        }
        return $ret;
    }
193512
protected function parsePlaceholders($pattern)
    {
        $params = [];
        $parser = $this->parser;

        preg_match_all("~" . $parser::DYNAMIC_REGEX . "~x", $pattern, $matches, PREG_SET_ORDER);

        foreach ((array) $matches as $key => $match) {
            $pattern = str_replace($match[0], isset($match[2]) ? "({$match[2]})" : "([^/]+)", $pattern);
            $params[$key] = $match[1];
        }

        return [$pattern, $params];
    }
299877
public function sql(ValueBinder $generator)
    {
        $parts = [
            'from' => $this->_from,
            'to' => $this->_to
        ];

        $field = $this->_field;
        if ($field instanceof ExpressionInterface) {
            $field = $field->sql($generator);
        }

        foreach ($parts as $name => $part) {
            if ($part instanceof ExpressionInterface) {
                $parts[$name] = $part->sql($generator);
                continue;
            }
            $parts[$name] = $this->_bindValue($part, $generator, $this->_type);
        }

        return sprintf('%s BETWEEN %s AND %s', $field, $parts['from'], $parts['to']);
    }
272361
public function getHavingString($usePlaceholders = true, $includeText = true)
    {
        $statement = $this->getCriteriaString($this->having, $usePlaceholders, $this->havingPlaceholderValues);

        if ($includeText && $statement) {
            $statement = "HAVING " . $statement;
        }

        return $statement;
    }
998870
public function valuesExpr($expression) {
		$args = func_get_args();
		$this->expression = array_shift($args);
		
		if (empty($args))
			return $this;
		
		//check if argument is a list
		try {
			$this->valuesArray($args[0]);
		}
		catch (\InvalidArgumentException $e) {
			$this->valueList = $args;
		}
		
		return $this;
	}
8087
protected function buildConditionString($field, $bind, $operator)
    {
        if (is_array($bind)) {
            foreach ($bind as &$val) {
                $val = $this->buildConditionString($field, $val, $operator);
                unset($val);
            }

            $logical = $operator === '!=' ? ' and ' : ' or ';

            return '(' . implode($logical, $bind) . ')';
        }

        if ($bind === null) {
            return $field . ' ' . ($operator == '!=' ? 'IS NOT NULL' : 'IS NULL');
        }

        if ($operator === 'regexp') {
            return sprintf('%s regexp %s', $field, $bind);
        }

        return $field . ' ' . $operator . ' ' . $bind;
    }
1022191
public function preProcessExpression(Expression $expression)
    {
        $expression = $this->completeExpression($expression);
        
        if ($this->isParameterized() && ($expression instanceof Expr\Parameter)) {
            
            $placeholder = $this->getPlaceholderForExpression($expression);
            if (null === $placeholder) {
                $placeholder = new Expr\Raw(':p' . $this->parameterCounter++);
                $this->setPlaceholder($expression->hashCode(), $placeholder);
            }
            
            return $placeholder;
        }
        
        return $expression;
    }
324107
public function toString($default=true)
    {
        $options = array();
        $binder = new Database\Binder();

        foreach ($this as $key=>$value) {
            $options[] = ($value === $default)
                ? $key
                : sprintf("%s=%s", $key, urlencode($value))
                ;
        }

        return implode(' ', $options);
    }
40093
public function resolvePlaceholders($string, Blueprint $sourceBlueprint=null, $sourceType=null, $sourceKey=null, $circuitBreaker=0)
    {
        if ($circuitBreaker > 20) {
            throw new \Exception('Max nesting level reached. Looks like a circular dependency.');
        }

        $stageClasses = [
            '\StackFormation\ValueResolver\Stage\ProfileSwitcher',
            '\StackFormation\ValueResolver\Stage\EnvironmentVariable',
            '\StackFormation\ValueResolver\Stage\EnvironmentVariableWithFallback',
            '\StackFormation\ValueResolver\Stage\Variable',
            '\StackFormation\ValueResolver\Stage\ConditionalValue',
            '\StackFormation\ValueResolver\Stage\Tstamp',
            '\StackFormation\ValueResolver\Stage\Md5',
            '\StackFormation\ValueResolver\Stage\StackOutput',
            '\StackFormation\ValueResolver\Stage\StackResource',
            '\StackFormation\ValueResolver\Stage\StackParameter',
            '\StackFormation\ValueResolver\Stage\Clean',
        ];

        $pipeline = new Pipeline();
        foreach ($stageClasses as $stageClass) {
            $pipeline->addStage(new $stageClass($this, $sourceBlueprint, $sourceType, $sourceKey));
        }

        $originalString = $string;
        $string = $pipeline->process($string);

        return ($string == $originalString) ? $string : $this->resolvePlaceholders($string, $sourceBlueprint, $sourceType, $sourceKey, $circuitBreaker+1);
    }
857614
protected function getFieldPlaceHolderForMenu(Label $placeholder = null, $name = '')
    {
        if (is_null($placeholder)) {
            return '';
        }

        return sprintf('<option value="" style="display: none;" {{ %s == \'\' ? \'selected\' : \'\' }} disabled selected>%s</option>', $this->getRawOptionValue($name, ''), $this->getTitle($placeholder, true));
    }
801169
public function convertExpressionsToStrings()
    {
        $this->setMainQuery((string) $this->getMainQuery());

        $this->setFilterQueries(array_map(
            function($expr) { return (string) $expr; },
            $this->getFilterQueries()
        ));

        return $this;
    }
222333
protected function _createPlaceholders($fields)
        {
            if (!empty($fields)) {
                $db_fields = [];

                foreach($fields as $key => $value) {
                    // Process expression fields directly into the query
                    if(Arrays::exists($key, $this->_expr_fields)) {
                        $db_fields[] = $value;
                    } else {
                        $db_fields[] = '?';
                    }
                }

                return implode(', ', $db_fields);
            }
        }