@param $level

@return PageInterface|null
188750
public function getParent($level = -1)
    {
        if (-1 === $level) {
            return $this->parent;
        }

        $parents = $this->getParents();

        if ($level < 0) {
            $level = count($parents) + $level;
        }

        return isset($parents[$level]) ? $parents[$level] : null;
    }
187613
public function getMenu($level = 1)
    {
        if ($level == 1) {
            $result = SiteTree::get()->filter([
                "ShowInMenus" => 1,
                "ParentID" => 0,
            ]);
        } else {
            $parent = $this->data();
            $stack = [$parent];

            if ($parent) {
                while (($parent = $parent->Parent()) && $parent->exists()) {
                    array_unshift($stack, $parent);
                }
            }

            if (isset($stack[$level - 2])) {
                $result = $stack[$level - 2]->Children();
            }
        }

        $visible = [];

        // Remove all entries the can not be viewed by the current user
        // We might need to create a show in menu permission
        if (isset($result)) {
            foreach ($result as $page) {
                /** @var SiteTree $page */
                if ($page->canView()) {
                    $visible[] = $page;
                }
            }
        }

        return new ArrayList($visible);
    }
1281143
private function setLevel($level)
    {
        $availableLevels = array_flip(Logger::getLevels());

        if (!isset($availableLevels[$level])) {
            throw new InvalidLoggerLevelException(
                sprintf(
                    'The level: "%d" does not exist. The available levels are: "%s"',
                    $level,
                    implode(', ', array_keys($availableLevels))
                ),
                400
            );
        }
        $this->level = $level;

        return $this;
    }
355774
public function setLevel($level)
    {
        if (is_numeric($level)) {
            $this->_level = (int)$level;
        } else {
            $this->_level = array_search($level, self::$_levels, true);
        }

        return $this;
    }
455306
public function level($level = null)
    {
        if ($level !== null) {
            $this->_level = $level;
        }

        return $this->_level;
    }
1341815
public function give(PermissionInterface $permission, $level = 'allow')
    {
        $current    =   $this->getPermission($permission->key);
        if (isset($current)) {
            if ($current->level === $level) {
                return true;
            }
            $this->remove($permission);
        }

        $this->removeFromLocalCache($permission->key);

        $this->permissions()->attach($permission, compact('level'));

        return false === is_null($this->getPermission($permission));
    }
1325645
protected function parseVerbosity($level = null)
    {
        if (isset($this->verbosityMap[$level])) {
            $level = $this->verbosityMap[$level];
        } elseif (! is_int($level)) {
            $level = $this->verbosity;
        }

        return $level;
    }
10735
public static function getPsrLevelFromCommon($level)
    {
        if (empty(self::$reverseMap[$level])) {
            throw new Exception('Invalid error level in PSR to Common level conversion: ' . $level);
        }

        return self::$reverseMap[$level];
    }
886273
public function level($level)
    {
        if ($level === null) {
            return $this;
        }
        
        $this->prepend = '   ' . (str_repeat('  ', $level));
        
        return $this;
    }
968046
public function getByFlagLevel(int $level, int $trackableType = Tracker::TRACKER_ANY, int $perPage = 15) : LengthAwarePaginator
    {
        return $this->getModel()
                    ->newQuery()
                    ->where('level', $level)
                    ->where($this->typeClosure($trackableType))
                    ->paginate($perPage);
    }
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;
    }
756584
public static function caller($level = 0)
    {
        $trace = debug_backtrace(0);

        if ($level < 0) {
            return $trace;
        } elseif (empty($trace[$level])) {
            return null;
        } elseif (empty($trace[$level]['file'])) {
            $level = 1;
        }

        $file = $trace[$level]['file'];
        $line = $trace[$level]['line'];

        $trace = null;

        return array(
            'file' => $file,
            'line' => $line
        );
    }
1231807
public static function getLogger($level = null)
    {
        if (empty($level)) {
            $level = static::DEFAULT_LEVEL;
        }

        if (empty(static::$logger)) {
            static::setLogger($level);
        }

        return static::$logger;
    }
1292123
public function setLogLevel($level= xPDO::LOG_LEVEL_FATAL) {
        $oldLevel = $this->logLevel;
        $this->logLevel= intval($level);
        return $oldLevel;
    }
488021
public function descendants($level = null)
	{
		$instance = self::blank();
		$instance->where('level', '>', $this->level)
		         ->order('lft', 'asc');

		if (isset($level))
		{
			$instance->where('level', '<=', $this->level + $level);
		}

		return $instance->where('lft', '>', $this->lft)
		                ->where('rgt', '<', $this->rgt)
		                ->applyScopesWhere($this);
	}
907109
public function showByLevel($date, $level, Request $request)
    {
        if ($level === 'all')
            return redirect()->route($this->showRoute, [$date]);

        $log     = $this->getLogOrFail($date);
        $query   = $request->get('query');
        $levels  = $this->logViewer->levelsNames();
        $entries = $this->logViewer->entries($date, $level)->paginate($this->perPage);

        return $this->view('show', compact('level', 'log', 'query', 'levels', 'entries'));
    }
602083
public function parseDirectory( $path = NULL, $levels = NULL )
    {
        if ( NULL !== $levels )
        {
            $this->levels = $levels;
        }

        $this->_runParse( $path );
        $this->_setResults();

        return $this->results;
    }