lithium\net\http\Router::get()

public static method

Returns one or multiple connected routes.

A specific route can be retrived by providing its index. All connected routes inside all scopes may be retrieved by providing null instead of the route index. To retrieve all routes for the current scope only, pass true for the $scope parameter.

Parameters

  • integer $route

    Index of the route.

  • string|boolean $scope

    Name of the scope to get routes from. Uses default scope if true.

Returns

object|array|null

If $route is an integer, returns the route object at given index or if that fails returns null. If $route is null returns an array of routes or scopes with their respective routes depending on the value of $scope.

Source

	public static function get($route = null, $scope = null) {
		if ($route === null && $scope === null) {
			return static::$_configurations;
		}

		if ($scope === true) {
			$scope = static::$_scope;
		}

		if ($route === null && $scope !== null) {
			if (isset(static::$_configurations[$scope])) {
				return static::$_configurations[$scope];
			}
			return [];
		}

		if (!isset(static::$_configurations[$scope][$route])) {
			return null;
		}
		return static::$_configurations[$scope][$route];
	}