• Модуль: perfmon
  • Путь к файлу: ~/bitrix/modules/perfmon/classes/general/sql_format.php
  • Класс: CSqlLevel
  • Вызов: CSqlLevel::addLevel
function addLevel(array $tokens)
{
	$this->level = array();
	$this->balance = 0;
	$this->tokens = $tokens;
	$this->current = 0;
	while (isset($this->tokens[$this->current]))
	{
		if ($this->tokens[$this->current][1] === "(")
			$this->balance++;
		elseif ($this->tokens[$this->current][1] === ")")
			$this->balance--;

		if ($this->tokens[$this->current][0] !== T_WHITESPACE)
			$this->changeLevelBefore();

		$this->tokens[$this->current][] = array_sum($this->level);

		if ($this->tokens[$this->current][0] !== T_WHITESPACE)
			$this->changeLevelAfter();

		$this->current++;
	}

	return $this->tokens;
}