Pass array expressions.

@param array $expression
339769
public function passArray(array $expression)
    {
        foreach ($expression['left'] as $item) {
            $usePass = self::DETECT_ARRAY_USE == ($this->detectionFlags & self::DETECT_ARRAY_USE);
            if ($usePass && 'variable' == $item['value']['type']) {
                $this->increaseMutations($item['value']['value']);
            } else {
                $this->passExpression($item['value']);
            }
        }
    }
1154915
protected function validExpressions(array $expressions = [])
    {
        foreach ($expressions as $expression) {
            if (!$expression instanceof AbstractExpression) {
                $errMsg = 'Некорректная коллекция объектов запросов в workflow';
                throw new InvalidArgumentException($errMsg);
            }
        }
    }
211555
public static function walkAll(array $expressions, callable $callback)
    {
        InvalidArgumentException::verifyAllInstanceOf(__METHOD__, 'expressions', $expressions, __CLASS__);

        foreach ($expressions as $expression) {
            $expression->walk($callback);
        }
    }
1298556
public function onPropertyAccessExpression($expression)
    {
        $parent = $expression;
        $variable = null;
        do {
            $variable = $parent->getResourceProperty()->getName() . self::MEMBER_ACCESS . $variable;
            $parent = $parent->getParent();
        } while ($parent != null);
        $variable = rtrim($variable, self::MEMBER_ACCESS);
        $variable = $this->getIteratorName() . self::MEMBER_ACCESS . $variable;
        return $variable;
    }
523136
public function normalizeExpression(Expression $expression)
    {
        $expression = $this->preProcessExpression($expression);
        
        switch (true) {
            // if has array parameters expression handle it recursively
            // if function expression extract from it all parameters and handle its
            case $expression instanceof Expr\Parameters:
            case $expression instanceof Expr\Func:
                
                $parameters = ($expression instanceof Expr\Func)
                    ? (new Expr\Parameters($expression->getParameters()))->getParameters()
                    : $expression->getParameters();
                
                foreach ($parameters as &$parameter) {
                    $parameter = $this->normalizeExpression($parameter);
                }
                
                $expression->setParameters($parameters);
                
                break;
            
            case $expression instanceof Expr\Table:
                
                if ($this->isReplaceAliases() === true) {
                    // replace table alias to real table name
                    if ($this->hasTableAlias($expression->getName())) {
                        $expression = $this->getTableByAlias($expression->getName());
                    }
                }
                
                break;
            
            // for column process it alias and real table if exist
            case $expression instanceof Expr\Column:
                
                if ($this->isReplaceAliases() === true) {
                    // replace column alias to real column name
                    if ($this->hasColumnAlias($expression->getName())) {
                        $expression = $this->getColumnByAlias($expression->getName());
                    }
                }
                
                break;
        }
        
        $expression = $this->postProcessExpression($expression);
        
        return $expression;
    }
534043
public function compile(array $expression, CompilationContext $compilationContext)
    {
        $compilationContext->headersManager->add('kernel/operators');

        if (!isset($expression['left'])) {
            throw new CompilerException("Invalid 'left' operand for 'empty' expression", $expression['left']);
        }

        $leftExpr = new Expression($expression['left']);
        $leftExpr->setReadOnly(true);
        $left = $leftExpr->compile($compilationContext);

        if ('variable' != $left->getType() && 'array' != $left->getType()) {
            throw new CompilerException("'empty' operand only can be a variable", $expression['left']);
        }

        $variableLeft = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression['left']);
        if (!$variableLeft->isVariable() && !$variableLeft->isString() && !$variableLeft->isArray()) {
            throw new CompilerException("Only dynamic/string variables can be used in 'empty' operators", $expression['left']);
        }

        return new CompiledExpression('bool', 'ZEPHIR_IS_EMPTY('.$compilationContext->backend->getVariableCode($variableLeft).')', $expression);
    }
692328
public static Expression arrayAppend(String expression, Expression value) {
        return arrayAppend(x(expression), value);
    }
808382
public function setExpression(Expression $expression)
    {
        $this->map['expressions']->set($expression->hashCode(), $expression->setBuilder($this));
        
        return $this;
    }
68351
public function addAnd($expression, ...$expressions) : self
    {
        if (! isset($this->query['$and'])) {
            $this->query['$and'] = [];
        }

        $this->query['$and'] = array_merge(
            $this->query['$and'],
            array_map(
                static function ($expression) {
                    return $expression instanceof Expr ? $expression->getQuery() : $expression;
                },
                func_get_args()
            )
        );

        return $this;
    }
1025657
public function passLetStatement(array $statement)
    {
        foreach ($statement['assignments'] as $assignment) {
            if (isset($assignment['expr'])) {
                $this->passExpression($assignment['expr']);
            }
            $this->increaseMutations($assignment['variable']);
            if (self::DETECT_VALUE_IN_ASSIGNMENT == ($this->detectionFlags & self::DETECT_VALUE_IN_ASSIGNMENT)) {
                if (isset($assignment['expr'])) {
                    if ('variable' == $assignment['expr']['type']) {
                        $this->increaseMutations($assignment['expr']['value']);
                        break;
                    }
                }
            }
        }
    }
1074688
final public static function simplifyAll(
            array $expressions,
            IEvaluationContext $context = null
    ) {
        $simplifiedExpressions = [];
        foreach ($expressions as $expression) {
            $simplifiedExpressions[] = $expression->simplify($context);
        }

        return $simplifiedExpressions;
    }
797562
public static function parseExpression($expression) {
    $tree = self::parseSource('<?php ' . $expression . ';');
    /** @var ExpressionStatementNode $statement_node */
    $statement_node = $tree->firstChild()->next();
    return $statement_node->getExpression()->remove();
  }
1002831
protected function parseJsonArguments(string $expression) : array
    {
        // Prepara o json
        $expression = preg_replace('#\{\s*#','{', $expression);  // transoforma [ em { sem espaços
        $expression = preg_replace('#\s*\}#','}', $expression);  // transoforma ] em } sem espaços
        $expression = preg_replace('#\s*:#',':', $expression);    // remove espaçoes antes de :
        $expression = preg_replace('#:\s*#',':', $expression);    // remove espaçoes após de :
        $expression = preg_replace('#,\s*#',',', $expression);    // remove espaços antes das virgulas
        $expression = preg_replace('#\s*,#',',', $expression);    // remove espaços após as virgulas

        // Aspas
        $expression = preg_replace("#'([a-zA-Z0-9\_-]*)':#",'"$1":', $expression); // transforma 'xxx': em "xxx":
        $expression = preg_replace("#:'([a-zA-Z0-9\_-]*)'#",':"$1"', $expression); // transforma :'xxx' em :"xxx":
        $expression = preg_replace('#:([^"])#',':"$1', $expression);  // Adiciona aspas ausentes no inicio dos valores
        $expression = preg_replace('#([^"]),"#','$1","', $expression);// Adiciona aspas ausentes no final dos valores
        $expression = preg_replace('#([^"])}#','$1"}', $expression);  // Adiciona aspas ausentes no final do json

        $decoded = json_decode($expression, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \InvalidArgumentException('Invalid json syntax');
        }

        return $decoded;
    }
754828
public function addFilter(string $expression): CopyDictionaryJob
    {
        // Check if the first and last char match - if not, we must encapsulate with '/'.
        if ($expression[0] !== substr($expression, -1)) {
            $expression = '/' . $expression . '/';
        }

        // Test if the regex is valid.
        try {
            preg_match($expression, '');
        } catch (\Throwable $error) {
            throw new \InvalidArgumentException(
                sprintf('Filter "%s" is not a valid regular expression - Error: %s', $expression, $error->getMessage()),
                0,
                $error
            );
        }

        $this->filters[] = $expression;

        return $this;
    }
735107
private function express($sql, $expression) {
        preg_match_all($expression, $sql, $matches);
        return array_unique(array_pop($matches));
    }
839566
public function compile(array $expression, CompilationContext $compilationContext)
    {
        $expr = new Expression($expression['right']);
        $expr->setReadOnly(true);
        $resolved = $expr->compile($compilationContext);

        if ('variable' != $resolved->getType()) {
            throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression);
        }

        $symbolVariable = $compilationContext->symbolTable->getVariableForRead(
            $resolved->getCode(),
            $compilationContext,
            $expression
        );

        if (!$symbolVariable->isVariable()) {
            throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression);
        }

        $symbolVariable->setDynamicTypes('object');
        $symbolVariable->setClassTypes($compilationContext->getFullName($expression['left']['value']));

        return $resolved;
    }
1318851
public function addExpression($expression)
    {
        if (!$this->expressions->contains($expression)) {
            $this->expressions[] = $expression;
        }

        return $this;
    }