Converts the Node into a SQL string fragment.

@param \Cake\Database\ValueBinder $generator Placeholder generator object

@return string
176071
public function sql(ValueBinder $generator)
    {
        $parts = [];
        $parts[] = 'CASE';
        foreach ($this->_conditions as $k => $part) {
            $value = $this->_values[$k];
            $parts[] = 'WHEN ' . $this->_compile($part, $generator) . ' THEN ' . $this->_compile($value, $generator);
        }
        if ($this->_elseValue !== null) {
            $parts[] = 'ELSE';
            $parts[] = $this->_compile($this->_elseValue, $generator);
        }
        $parts[] = 'END';

        return implode(' ', $parts);
    }
172767
private function prepareOperator(?string $operator, $value): string
    {
        $operator = strtoupper($operator);

        if (!$operator) {
            $operator = is_array($value) ? 'IN' : '=';
        }

        if ($operator === 'IN' and !is_array($value)) {
            $operator = '=';
        }

        if ($operator !== 'IN' and is_array($value)) {
            throw new SqlException('Value could not be an array in condition for operator `' . $operator . '`.');
        }

        return $operator;
    }
611343
protected function placeholderResolver()
    {
        if (null === $this->placeholderResolver) {
            $this->placeholderResolver = new RegexPlaceholderResolver(new ConfigurationDataSource($this), '%', '%');
        }

        return $this->placeholderResolver;
    }
697979
private function getNodeList() : Generator
    {
        $xpath    = new DOMXPath($this->document);
        $nodeList = $xpath->query('//input | //textarea | //select | //div[@data-input-name]');

        /** @var DOMElement $node */
        foreach ($nodeList as $node) {
            $name = $node->getAttribute('name');
            if (! $name) {
                $name = $node->getAttribute('data-input-name');
            }

            if (! $name || $node->getAttribute('type') === 'submit') {
                // At least a name is needed to submit a value.
                // Silently continue, might be a submit button.
                continue;
            }

            if ($node->hasAttribute('disabled')) {
                // Ignore disabled nodes
                continue;
            }

            yield $name => $node;
        }
    }
963328
protected function generateString($generator)
    {
        $string = '';

        while (strlen($string) < $size = $this->getSize()) {
            $string .= $this->extractPattern($generator($size));
        }

        return $this->trimToExpectedSize($string, $size);
    }
629912
public function normalizeValue($generator)
	{
		if (is_string($generator))
		{
			$className = 's9e\\TextFormatter\\Configurator\\RulesGenerators\\' . $generator;

			if (class_exists($className))
			{
				$generator = new $className;
			}
		}

		if (!($generator instanceof BooleanRulesGenerator)
		 && !($generator instanceof TargetedRulesGenerator))
		{
			throw new InvalidArgumentException('Invalid rules generator ' . var_export($generator, true));
		}

		return $generator;
	}
1069316
public function compileQuery(Query $query, ValueBinder $generator)
    {
        return $this->getDriver()->compileQuery($query, $generator)[1];
    }
292893
private function prepareQueryBinding(array $binding)
    {
        $value = $binding['value'];

        list ($type, $val) = $this->toGrpcValue($value);

        $binding['value'][$type] = $val;

        return $binding;
    }
473487
public function run(Generator $generator): string
    {
        return str_replace(
            $this->call,
            $generator->format($this->formatter, $this->parseArguments()),
            $this->definition
        );
    }
1192531
protected function getFieldPlaceHolder(Label $placeholder = null)
    {
        if (is_null($placeholder)) {
            return '';
        }

        return empty($placeholder) ? '' : sprintf(' placeholder="%s"', $this->getTitle($placeholder, true));
    }
190975
public function generate(&$result,GeneratorInterface $generator)
    {
        if($this->literals->count() === 0) {
            throw new GeneratorException('There are no literals to choose from');
        }
        
       $repeat_x = $this->calculateRepeatQuota($generator);
        
        while($repeat_x > 0) {
             $randomIndex = 0;
             
             if($this->literals->count() > 1) {
                $randomIndex = \round($generator->generate(1,($this->literals->count())));        
             }
             
             $result     .= $this->literals->getAt($randomIndex);
             
             --$repeat_x;
        }
        
        return $result;
        
    }
868286
public function sql(ValueBinder $generator)
    {
        $field = $this->_field;

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

        if ($this->_value instanceof ExpressionInterface) {
            $template = '%s %s (%s)';
            $value = $this->_value->sql($generator);
        } else {
            list($template, $value) = $this->_stringExpression($generator);
        }

        return sprintf($template, $field, $this->_operator, $value);
    }
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;
    }
108502
public function build(Generator $generator)
    {
        $renderer = new DOMRenderer($generator, $this);
        $publisher = new Publisher($generator, $this);

        $pageManager = $this->loadPageManager($generator);
        while (!$pageManager->getQueue()->isEmpty()) {
            $page = $pageManager->getQueue()->dequeue();

            if ($pageManager->hasPage($page)) {
                continue;
            }

            // Parse the source file:
            $sourceFile = $pageManager->getSourceFile($page);

            // Register the page:
            $pageManager->addPage($page, $sourceFile);

            // Parse the content:
            $content = $renderer->renderContentElement($sourceFile->getContent());

            // And add the content to the publisher:
            $publisher->add($page, $content);
        }

        $publisher->publish();
    }
141157
public function getQuery(): string {
        $query  = $this->query;
        $values = $this->values;

        $matches = null;
        preg_match_all('/[?][#@][a-zA-Z]?[a-zA-Z0-9_]*/', $query, $matches);
        $matches = count($matches) > 0 ? $matches[0] : array();

        foreach ($matches as $i) {
            $varName = substr($i, 2);
            if ($varName != '') {
                if (!isset($this->values[$varName])) {
                    throw new RuntimeException('no value for variable ' . $varName);
                }
                $value = $values[$varName];
                unset($values[$varName]);
            } else {
                if (count($values) == 0) {
                    throw new RuntimeException('number of values lower then the number of variables in the query');
                }
                $value = array_shift($values);
            }
            $value = substr($i, 1, 1) == '#' ? QueryParameter::escapeLiteral($value) : QueryParameter::escapeUri($value);
            $value = str_replace(array('\\', '$'), array('\\\\', '\\$'), $value); // preg replace special chars escape
            $query = preg_replace('/[?][#@]' . $varName . '/', $value, $query, 1);
        }
        if (count($values) > 0) {
            throw new RuntimeException('number of values greater then the number of variables in the query');
        }

        return $query;
    }
1107840
public function getNodeTranslationsQueryBuilder($lang = null)
    {
        $queryBuilder = $this->createQueryBuilder('nt')
            ->select('nt,n,v')
            ->innerJoin('nt.node', 'n')
            ->leftJoin(
                'nt.publicNodeVersion',
                'v',
                'WITH',
                'nt.publicNodeVersion = v.id'
            )
            ->where('n.deleted = false')
            ->orderBy('nt.weight')
            ->addOrderBy('nt.weight');

        if (!empty($lang)) {
            $queryBuilder
                ->andWhere('nt.lang = :lang')
                ->setParameter('lang', $lang);
        }

        return $queryBuilder;
    }
907376
public function sql(ValueBinder $generator)
    {
        $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);
    }