@param string $level

@return array

@throws Exceptions\PDOConnectionException
@throws Exceptions\QueryCountNotMatchParamsException
@throws Exceptions\QueryExecutionException
@throws InvalidIsolationLevelException
974011
public function setIsolationLevel(string $level) : array
    {
        if (!\in_array($level, static::ISOLATION_LEVELS, true)) {
            throw new InvalidIsolationLevelException();
        }

        static $oldIsolationLevel;
        if (!$oldIsolationLevel) {
            $oldIsolationLevel = $this->query('SHOW transaction_isolation')[0]['transaction_isolation'];
        }

        $this->query("SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL $level");
        $oldIsolationLevel = $level;

        return [$oldIsolationLevel, $level];
    }
1091509
protected function getLevelName($level)
    {
        return in_array($level, self::$levels) ? array_search($level, self::$levels) : '--';
    }
1371749
public function findByLevels($levels = 1, $ids = array())
    {
        $query = $this->createQueryBuilder('c');

        if ($levels > 0) {
            $selects = ['c'];
            for ($i = 1; $i <= $levels; ++$i) {
                $selects[] = 'c'.$i;
            }

            $query->select($selects);

            for ($i = 1; $i <= $levels; ++$i) {
                $previous = ($i - 1 == 0) ? '' : ($i - 1);
                $query->leftJoin('c'.$previous.'.children', 'c'.$i, 'WITH', 'c'.$i.'.active = :active AND c'.$i.'.showInNavigation = :show');
            }
        }

        if ($ids) {
            $query->andWhere('c.id IN (:ids)')->setParameter('ids', $ids);
        } else {
            $query->andWhere('c.parent IS NULL');
        }

        $query->andWhere('c.active = :active')->setParameter('active', true);
        $query->andWhere('c.layout = :layout')->setParameter('layout', false);
        $query->andWhere('c.showInNavigation = :show')->setParameter('show', true);

        return $query->getQuery()->getResult();
    }
372678
private function getFilters(array $filters, $level)
    {
        if (empty($filters)) {
            return '';
        }

        $name     = array_shift($filters);
        $method   = $this->getFindMethod($name);
        $filter   = ($method !== 'last') ? var_export($name, true) : '';
        $callable = $this->getCallable('$filter');
        $msg      = var_export($name, true);

        return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $callable, $msg, $this->getFilters($filters, $level));
    }
519856
public function getDescendants($depth = null)
    {
        if(!$this->hasChildren())
        {
            return array();
        }

        if($this->descendants === null)
        {
            $qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
            $alias = $this->getManager()->getConfiguration()->getQueryBuilderAlias();

            $qb->andWhere("$alias.".$this->getLeftFieldName()." > :lft1")
                ->setParameter('lft1', $this->getLeftValue())
                ->andWhere("$alias.".$this->getRightFieldName()." < :rgt1")
                ->setParameter('rgt1', $this->getRightValue())
                ->orderBy("$alias.".$this->getLeftFieldName(), "ASC");
            if($this->hasManyRoots())
            {
                $qb->andWhere("$alias.".$this->getRootFieldName()." = :root")
                    ->setParameter('root', $this->getRootValue());
            }

            // TODO: Add depth support or self join support?
			$q = $qb->getQuery();
			if ($this->getManager()->getConfiguration()->isQueryHintSet()){
				$q = $this->getManager()->addHintToQuery($q);
			}
            $results = $q->getResult();

            $this->descendants = array();
            foreach($results as $result)
            {
                $this->descendants[] = $this->getManager()->wrapNode($result);
            }
        }

        if($depth !== null)
        {
            // TODO: Don't rebuild filtered array everytime?
            return $this->getManager()->filterNodeDepth($this->descendants, $depth);
        }

        return $this->descendants;
    }
953302
public static function toBitrixLevel($level)
    {
        $levels = static::logLevels();

        if (isset($levels[$level]))
        {
            return $levels[$level];
        }

        return false;
    }
206986
public function get($level = null)
    {
        if (isset($level)) {
            return $this->getMessage();
        }

        return $this->current->where('level', $level);
    }
1152174
public function getCurrentToAttr($level)
    {
        $lookupNames = StringHelper::split(BaseLookup::$lookupPattern, $this->prefetchTo);
        $toAttr = $lookupNames[$level];
        $hasAsAttr = $this->toAttr && $level === count($lookupNames) - 1;
        return [$toAttr, $hasAsAttr];
    }
233277
public function getChildrenDsIds($dsId, $level = 1)
    {
        $childrenDsIds = (array_key_exists($dsId, $this->childrenMap))
            ? $this->childrenMap[$dsId]
            : [];

        if (($level > 1) && count($childrenDsIds)) {
            $subChildDsIds = [$childrenDsIds];

            foreach ($childrenDsIds as $childDsId) {
                $subChildDsIds[] = $this->getChildrenDsIds($childDsId, $level - 1);
            }

            $childrenDsIds = call_user_func_array('array_merge', $subChildDsIds);
        }

        return $childrenDsIds;
    }
1026314
public static function getVerbosityForLevel($level) {
        if ($level === 0) {
            return self::NORMAL;
        }

        if ($level === 1) {
            return self::VERBOSE;
        }

        if ($level === 3) {
            return self::SILENT;
        }

        return self::DEBUG;
    }
79410
public function getFixesForLevel($level)
    {
        if ($level == $this->levels[0]) {
            return array();
        }
        $activated_levels = array();
        for ($i = 1, $c = count($this->levels); $i < $c; $i++) {
            $activated_levels[] = $this->levels[$i];
            if ($this->levels[$i] == $level) {
                break;
            }
        }
        if ($i == $c) {
            trigger_error(
                'Tidy level ' . htmlspecialchars($level) . ' not recognized',
                E_USER_WARNING
            );
            return array();
        }
        $ret = array();
        foreach ($activated_levels as $level) {
            foreach ($this->fixesForLevel[$level] as $fix) {
                $ret[$fix] = true;
            }
        }
        return $ret;
    }
122663
public function level($level)
    {
        if (empty($level)) {
            $level = [];
        } elseif (is_string($level)) {
            $level = explode(',', str_replace(' ', '', $level));
        } else {
            $level = is_array($level) ? $level : func_get_args();
        }

        $this->setLevel($level);

        return $this;
    }
696525
public static function toMonologLevel($level): int
    {
        if (is_string($level)) {
            if (defined(__CLASS__.'::'.strtoupper($level))) {
                return constant(__CLASS__.'::'.strtoupper($level));
            }

            throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
        }

        return $level;
    }
1089652
protected function parseLevel( $level )
	{
		if ( isset( $this->levels[$level] ) )
			return $this->levels[$level];

		throw new InvalidArgumentException( 'Invalid log level.' );
	}
455306
public function level($level = null)
    {
        if ($level !== null) {
            $this->_level = $level;
        }

        return $this->_level;
    }
244772
public static function isLevelFatal($level)
    {
        $errors = E_ERROR;
        $errors |= E_PARSE;
        $errors |= E_CORE_ERROR;
        $errors |= E_CORE_WARNING;
        $errors |= E_COMPILE_ERROR;
        $errors |= E_COMPILE_WARNING;
        return ($level & $errors) > 0;
    }
1160835
public function setLevel($level)
    {
        if (($level < 0) || ($level > 9)) {
            throw new Exception\InvalidArgumentException('Level must be between 0 and 9');
        }

        $this->options['level'] = (int) $level;
        return $this;
    }