Returns a fixed navigation menu of the given level.
@param int $level Menu level to return.
@return ArrayList
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);
    }
274979
public function getChildren(MenuItem $parent = null)
    {
        if ($parent === null) {
            return $this->getTopChildren();
        }
        /* @var $request Request */
        $request = $this->container->get('request_stack')->getCurrentRequest();
        $result = array();
        foreach ($this->getAdaptors() as $menuAdaptor) {
            $menuAdaptor->adaptChildren($this, $result, $parent, $request);
        }

        return $result;
    }
1290274
public function setLevel($level)
    {
        if ($level < 0 || $level > 100) {
            throw new \InvalidArgumentException(sprintf(
                    'Invalid Postrize Level "%s"', (string) $level
            ));
        }
        $this->level = (int) $level;

        return $this;
    }
305798
public static function getLevelByName($level)
    {
        $level = strtoupper($level);
        if (!isset(static::$levelNameToLevel[$level])) {
            return static::ALL;
        }

        return static::$levelNameToLevel[$level];
    }
982886
public static function getLevel($level = null) {

        $level = strtoupper($level);

        if ( array_key_exists($level, self::$levels) ) return self::$levels[$level];

        return self::$levels[self::DEFAULT_LOG_LEVEL];

    }
53407
public function setHeadingDisplayLevel(int $level) : Bootstrap4Jumbotron
    {
        if (in_array($level, $this->supported_display_levels) === true) {
            $this->display_level = $level;
        }

        return $this;
    }
304025
protected function _getActiveMenuPattern($level = 0, $urlInfo = null) {
		if (empty($urlInfo) || !is_array($urlInfo)) {
			return false;
		}

		$level = (int)$level;
		extract($urlInfo);
		if (($level < 0) || ($level > 2)) {
			$level = 0;
		}

		if ($level > 1) {
			$action = 'index';
		}
		if ($level == 0) {
			$userPrefix = $this->Session->read('Auth.User.prefix');
			if (empty($prefix) && !empty($userPrefix)) {
				$prefix = $userPrefix;
			}
		}

		$url = compact(
			'controller',
			'action',
			'plugin',
			'prefix'
		);
		if (!empty($prefix)) {
			$url[$prefix] = true;
		}
		$href = $this->url($url);
		$href = preg_quote($href, '/');
		if (!empty($pass) || !empty($named)) {
			if (((($level == 0) && (mb_stripos($action, 'index') === false)) ||
				($level == 2)) && ($href !== '\/')) {
				$href .= '\/?.*';
			}
		}
		$activePattern = '/<a\s+href=\"' . $href . '\".*>/iu';

		return $activePattern;
	}
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];
    }
643537
protected function toList(array $items = [], $level = 0)
    {
        $prefix = str_repeat('&nbsp;&nbsp;', $level);

        $pages = [];

        foreach ($items as $item) {
            $pages[$item['id']] = $prefix . '' . $item['title'];

            if ($item['children']) {
                $pages += $this->toList($item['children'], $level + 1);
            }
        }

        return $pages;
    }
953456
public function feedbacks($level = null)
    {
        if ($level !== null) {
            if (!is_string($level)) {
                throw new InvalidArgumentException('The feedback level must be a string');
            }

            $level = $this->resolveFeedbackLevel($level);

            $subset = [];
            foreach ($this->feedbacks as $item) {
                if ($item['level'] === $level) {
                    $subset[] = $item;
                }
            }

            return $subset;
        }

        return $this->feedbacks;
    }
1088564
public function getXp(int $level)
    {
        $xpTable = $this->getXpTable();

        if (!isset($xpTable[$level])) {
            return false;
        }

        return $xpTable[$level];
    }
1131331
public static function getHandler($level = null)
    {
        if (empty($level)) {
            $level = static::DEFAULT_LEVEL;
        }

        if (empty(static::$handler)) {
            static::setHandler($level);
        }
        return static::$handler;
    }
206986
public function get($level = null)
    {
        if (isset($level)) {
            return $this->getMessage();
        }

        return $this->current->where('level', $level);
    }
213644
public function withLogLevel($level)
    {
        $logger = clone $this;
        $logger->level = $this->convertLevel($level);
        return $logger;
    }
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;
    }
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;
    }
455306
public function level($level = null)
    {
        if ($level !== null) {
            $this->_level = $level;
        }

        return $this->_level;
    }