@param string      $intervalVariable
@param string      $callbackVariable
@param string      $requirementVariable
@param string|null $nextStatement

@return string
486189
private function renderRequirement(
        $intervalVariable,
        $callbackVariable,
        $requirementVariable,
        $nextStatement = null
    ) {
        $formatter = $this->getFormatter();
        $codes = [$formatter->renderCall($callbackVariable, [], true)];

        if (empty($nextStatement)) {
            array_unshift($codes, $formatter->renderCall('clearInterval', [$intervalVariable], true));
        }

        return $formatter->renderStatement(
            'if',
            $formatter->renderLines($codes, true, false),
            $formatter->renderCall($requirementVariable),
            $nextStatement,
            false
        );
    }
1128626
public void buildForMissingInterval(@Nullable final LocalDate startDate, @Nullable final LocalDate endDate, @Nullable final UUID targetInvoiceId, final Collection<Item> output, final boolean addRepair) {
        final Item item = createNewItem(startDate, endDate, targetInvoiceId, addRepair);
        if (item != null) {
            output.add(item);
        }
    }
1362555
public function getNextStatement()
    {
        $isAfterBackslash = false;
        $isInString = false;
        $stringQuotes = '';
        $parsedString = '';
        $lowercaseString = ''; // helper variable for performance sake
        while ($this->pos <= $this->len) {
            $char = isset($this->sql[$this->pos]) ? $this->sql[$this->pos] : '';
            // check flags for strings or escaper
            switch ($char) {
                case "\\":
                    $isAfterBackslash = true;
                    break;
                case "'":
                case "\"":
                    if ($isInString && $stringQuotes == $char) {
                        if (!$isAfterBackslash) {
                            $isInString = false;
                        }
                    } elseif (!$isInString) {
                        $stringQuotes = $char;
                        $isInString = true;
                    }
                    break;
            }
            $this->pos++;
            if ($char !== "\\") {
                $isAfterBackslash = false;
            }
            if (!$isInString) {
                if (false !== strpos($lowercaseString, 'delimiter ')) {
                    // remove DELIMITER from string because it's a command-line keyword only
                    $parsedString = trim(str_ireplace('delimiter ', '', $parsedString));
                    // set new delimiter
                    $this->delimiter = $char;
                    // append other delimiter characters if any
                    while (isset($this->sql[$this->pos]) && $this->sql[$this->pos] != "\n") {
                        $this->delimiter .= $this->sql[$this->pos++]; // increase position
                    }
                    $this->delimiter = trim($this->delimiter);
                    // store delimiter length for better performance
                    $this->delimiterLength = strlen($this->delimiter);
                    // delimiter has changed so return current sql if any
                    if ($parsedString) {
                        return $parsedString;
                    } else {
                        // reset helper variable
                        $lowercaseString = '';
                        continue;
                    }
                }
                // get next characters if we have multiple characters in delimiter
                $nextChars = '';
                for ($i = 0; $i < $this->delimiterLength - 1; $i++) {
                    if (!isset($this->sql[$this->pos + $i])) break;
                    $nextChars .= $this->sql[$this->pos + $i];
                }
                // check for end of statement
                if ($char.$nextChars == $this->delimiter) {
                    $this->pos += $i; // increase position
                    return trim($parsedString);
                }
                // avoid using strtolower on the whole parsed string every time new character is added
                // there is also no point in adding characters which are in the string
                $lowercaseString .= strtolower($char);
            }
            $parsedString .= $char;
        }
        return trim($parsedString);
    }
1159128
public function createSqlFromProcedure($procedureName, array $bindings, $cursor = false)
    {
        $paramsString = implode(',', array_map(function ($param) {
            return ':' . $param;
        }, array_keys($bindings)));

        $prefix = count($bindings) ? ',' : '';
        $cursor = $cursor ? $prefix . $cursor : null;

        return sprintf('begin %s(%s%s); end;', $procedureName, $paramsString, $cursor);
    }
460004
private function parseEnv(string $variableName, bool $required = true)
    {
        $result = null;

        if (\getenv($variableName) === 'false') {
            $result = false;
        } elseif (\getenv($variableName) === 'true') {
            $result = true;
        }
        if (\getenv($variableName) !== false) {
            $result = \getenv($variableName);
        }

        if ($required === true && $result === null) {
            throw new MissingEnvVariableException($variableName);
        }

        return $result;
    }
189843
private function insertData($callback = null): void
    {
        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['pre_actions']
        );

        for ($rowNum = 1; $rowNum <= $this->limit; $rowNum++) {
            // Call the right method according to the mode
            $this->{$this->insertMode[$this->mode]}($rowNum);

            if (!is_null($callback)) {
                $callback($rowNum);
            }
        }

        // Run a final method if defined
        if ($this->mode === 'batch') {
            $this->loadDataInBatch('insert');
        }

        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['post_actions']
        );
    }
622310
public static ChainableStatement error(JsScope jsScope)
	{
		return new DefaultChainableStatement(StateEvent.ERROR.getEventLabel(), jsScope.render());
	}
97303
public function getVariable($callId, $variableIdentifier)
    {
        $sql = 'SELECT * FROM ' . self::VARIABLES_TABLENAME . '
        WHERE (' . self::CALL_ID_ITEM_COLUMN . ' = ? OR ' . self::CALL_ID_TEST_COLUMN . ' = ?)
        AND ' . self::VARIABLE_IDENTIFIER . ' = ?';

        $params = array($callId, $callId, $variableIdentifier);
        $variables = $this->getPersistence()->query($sql, $params);

        $returnValue = array();

        // for each variable we construct the array
        foreach ($variables as $variable) {
            $returnValue[$variable[self::VARIABLES_TABLE_ID]] = $this->getResultRow($variable);
        }
        return $returnValue;

    }
246869
public static function getCheckStrFromSession($sessionVariable, $expected_value)
    {

        $success = false;

        $session_value = $_SESSION[$sessionVariable];
        if ($expected_value === $session_value) {
            echo(' checked="checked" ');

            $success = true;

        }

        return $success;
    }
479890
public function apply($dbDriver, $alias, $field, $exprValue, $namedParameter = null, &$value = null)
	{
		$value = [];
		$matches = [];
		$leftExpr = $alias.'.'.$field;
		
		if (!preg_match(self::PATTERN, $exprValue, $matches)) {
			throw new BadQueryExprException(sprintf('The query expression converter "range" does not support the following pattern "%s".', $exprValue));
		}
		
		switch (true) {
			case $matches[2] && !$matches[3]:
				$rightExpr = $namedParameter ?: ':'.$field;
				$value[$rightExpr] = trim($matches[2]);
				
				return $this->createGreaterThanExpr($leftExpr, $matches[1], $rightExpr);
				
			case !$matches[2] && $matches[3]:
				$rightExpr = $namedParameter ?: ':'.$field;
				$value[$rightExpr] = trim($matches[3]);
				
				return $this->createLessThanExpr($leftExpr, $matches[4], $rightExpr);
				
			case $matches[2] && $matches[3]:
				$rightExpr1 = ($namedParameter ?: ':'.$field) . '1';
				$rightExpr2 = ($namedParameter ?: ':'.$field) . '2';
				$value[$rightExpr1] = trim($matches[2]);
				$value[$rightExpr2] = trim($matches[3]);
				
				return (new \Doctrine\ORM\Query\Expr())->andX(
						$this->createGreaterThanExpr($leftExpr, $matches[1], $rightExpr1), 
						$this->createLessThanExpr($leftExpr, $matches[4], $rightExpr2)
					);
				
			default:
				throw new BadQueryExprException('The range query expression converter requires left or right value of range');
		}
	}
422530
private function generateRangeVariableDeclarationSQL($rangeVariableDeclaration, bool $buildNestedJoins) : string
    {
        $class    = $this->em->getClassMetadata($rangeVariableDeclaration->abstractSchemaName);
        $dqlAlias = $rangeVariableDeclaration->aliasIdentificationVariable;

        if ($rangeVariableDeclaration->isRoot) {
            $this->rootAliases[] = $dqlAlias;
        }

        $tableName  = $class->table->getQuotedQualifiedName($this->platform);
        $tableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias);

        $sql = $this->platform->appendLockHint(
            $tableName . ' ' . $tableAlias,
            $this->query->getHint(Query::HINT_LOCK_MODE)
        );

        if ($class->inheritanceType !== InheritanceType::JOINED) {
            return $sql;
        }

        $classTableInheritanceJoins = $this->generateClassTableInheritanceJoins($class, $dqlAlias);

        if (! $buildNestedJoins) {
            return $sql . $classTableInheritanceJoins;
        }

        return $classTableInheritanceJoins === '' ? $sql : '(' . $sql . $classTableInheritanceJoins . ')';
    }
1277787
private String replaceFromVariableStatementInternal(JQLContext context, String jql, final List<Triple<Token, Token, String>> replace, JqlBaseListener rewriterListener) {
		Pair<ParserRuleContext, CommonTokenStream> parser = prepareVariableStatement(context, jql);
		walker.walk(rewriterListener, parser.value0);

		TokenStreamRewriter rewriter = new TokenStreamRewriter(parser.value1);

		for (Triple<Token, Token, String> item : replace) {
			rewriter.replace(item.value0, item.value1, item.value2);
		}

		return rewriter.getText();
	}
311364
function(callback){
			if(!this.id){
				return process.nextTick(function(){
					callback(new Error("Invalid session ID"));
				});
			}
			options.client.expire(options.keyspace + this.id, options.maxAge, callback);
		}
763921
public void setNullForStatement(PreparedStatement ps, int index, int sqlType) throws SQLException
    {
        ps.setNull(index, sqlType);
    }
1184129
protected function prepareResults(PDOStatementHandle $statement, $errorLevel, $sql, $parameters = array())
    {

        // Catch error
        if ($this->hasError($statement)) {
            $this->lastStatementError = $statement->errorInfo();
            $statement->closeCursor();

            $this->databaseError($this->getLastError(), $errorLevel, $sql, $this->parameterValues($parameters));

            return null;
        }

        // Count and return results
        $this->rowCount = $statement->rowCount();
        return new PDOQuery($statement);
    }
127431
public static ChainableStatement trigger(EventLabel eventLabel, CharSequence... data)
	{
		return new DefaultChainableStatement("trigger", JsUtils.quotes(eventLabel.getEventLabel()),
			JsUtils.array(data));
	}
555137
public function RangeVariableDeclaration()
    {
        if ($this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS) && $this->lexer->glimpse()['type'] === Lexer::T_SELECT) {
            $this->semanticalError('Subquery is not supported here', $this->lexer->token);
        }

        $abstractSchemaName = $this->AbstractSchemaName();

        $this->validateAbstractSchemaName($abstractSchemaName);

        if ($this->lexer->isNextToken(Lexer::T_AS)) {
            $this->match(Lexer::T_AS);
        }

        $token                       = $this->lexer->lookahead;
        $aliasIdentificationVariable = $this->AliasIdentificationVariable();
        $classMetadata               = $this->em->getClassMetadata($abstractSchemaName);

        // Building queryComponent
        $queryComponent = [
            'metadata'     => $classMetadata,
            'parent'       => null,
            'relation'     => null,
            'map'          => null,
            'nestingLevel' => $this->nestingLevel,
            'token'        => $token,
        ];

        $this->queryComponents[$aliasIdentificationVariable] = $queryComponent;

        return new AST\RangeVariableDeclaration($abstractSchemaName, $aliasIdentificationVariable);
    }