/* ---------------- GET ROUTES ----------------
484761
protected final <REQ, RESP> Route get(RouteAction<Request<REQ>, Response<RESP>> action,
		RequestType<REQ> req, ResponseType<RESP> resp) {
		return createEntityRoute(HttpMethod.GET, "", action, req, resp);
	}
135119
function (route) {
	if ( this.safenames ) {
		route = route.split( '/' );
		var name = route.pop();
		name = safename( name );
		route.push( name );
		return route.join( '/' );
	} else {
		return route;
	}
}
923874
function transformRoutes(routes) {
  if (typeof routes !== 'object') {
    throw new Error('Invalid route config');
  }
  var config = clone(routes);

  return Object.keys(config).map(function(name){
    var opt = config[name];
    // sugar for specifying fn
    if (typeof opt === 'function') {
      opt = {
        view: opt
      };
    } else if (typeof opt !== 'object') {
      throw new Error('Invalid route config for ' + name);
    }

    var defaultRoute = opt.defaultChild ? DefaultRoute({
      key: (opt.defaultChild.key || name + 'Default'),
      name: (opt.defaultChild.name || name + 'Default'),
      handler: opt.defaultChild.view
    }) : null;

    var notFoundRoute = opt.childNotFound ? NotFoundRoute({
      key: (opt.childNotFound.key || name + 'NotFound'),
      name: (opt.childNotFound.name || name + 'NotFound'),
      handler: opt.childNotFound.view
    }) : null;

    var children = (opt.children ? transformRoutes(opt.children) : []);
    if (defaultRoute) {
      children.push(defaultRoute);
    }
    if (notFoundRoute) {
      children.push(notFoundRoute);
    }
    return Route({
      key: name,
      name: name,
      path: opt.path,
      handler: opt.view
    }, children);
  });
}
482391
function routeAndCorrectedPathIndexes(routes, pathIndex) {
        for(var n=0; n<routes.length; n++) {
            var pathIndexes = routes[n].pathIndexes
            if(pathIndexes.start <= pathIndex && pathIndex <= pathIndexes.end || routes[n].route.isDefault) {
                return {routeIndex: n, pathIndex: pathIndexes.start}
            }
        }
        // else
        return {routeIndex: routes.length, pathIndex: pathIndex}
    }
1071982
protected function getRoutes()
    {
        if (0 === count($this->routes)) {
            return $this->router->getRouteCollection()->all();
        }

        $routes = [];
        foreach ($this->routes as $name) {
            $route = $this->router->getRouteCollection()->get($name);
            if (null !== $route) {
                $routes[$name] = $route;
            }
        }

        return $routes;
    }
1223193
function (route) {
  if (!route) {
    return null;
  }
  let ts = route.split('.');
  if (ts.length !== 3) {
    return null;
  }

  return {
    route: route,
    serverType: ts[0],
    handler: ts[1],
    method: ts[2]
  };
}
1282508
function Route(method, route, fn) {
    this.method = method;
    this.route = route;
    this.fn = fn;

    return function (app) {
        var middleware = exports.isAppSettingsRoute(route) ? utils.getSettingsMiddlewares() :
            utils.getRequestMiddlewares();

        if (method == "get") {
            app.get(route, middleware, fn)
        }
        else if (method == "post") {
            app.post(route, middleware, fn);
        }
//        var methodRoutes = app.routes[method];
//        return methodRoutes[methodRoutes.length - 1];
    };
}
1008668
protected Route.Filtering get(final String path, final Result result) {
        return get(path, () -> result);
    }
1272731
public function routes()
    {
        Route::get('countries/{id}', function ($id) {
            $request = request();
            return CountryStore::country($id, $request);
        })->name('country');

        Route::get('countries', function () {
            $request = request();
            return CountryStore::countries($request);
        })->name('countries');

        Route::get('administrative_areas/{id}', function ($id) {
            $request = request();
            return CountryStore::administrativeArea($id, $request);
        })->name('administrative_area');

        Route::get('cities/{city_id}', function ($city_id) {
                $request = request();
                return CountryStore::city($city_id, $request);
        })->name('city');
    }
181504
public java.util.List<TransitGatewayRoute> getRoutes() {
        if (routes == null) {
            routes = new com.amazonaws.internal.SdkInternalList<TransitGatewayRoute>();
        }
        return routes;
    }
1023892
public function get(string $method = null) : array
    {
        if ($method === null) {
            return $this->routes;
        } elseif (isset($this->routes[$method])) {
            return $this->routes[$method];
        } else {
            return [];
        }
    }
1049065
public function getRoutes() : array {
        $request = get_request();
        $requestMethod = $request->method();
        $requestPathParts = $request->pathParts();
        $routesIndex = $this->routesIndex;
        $routes = [];
        $this->getRoutesFromIndex($routes,$routesIndex, $requestMethod, $requestPathParts);
        return $routes;
    }
990669
func (rm *RouteManager) Get(id string) (*Route, error) {
	rm.Lock()
	defer rm.Unlock()
	route, ok := rm.routes[id]
	if !ok {
		return nil, os.ErrNotExist
	}
	return route, nil
}
828203
public function getRoutes()
	{
		$router_factory = new RouterFactory;
		$router = $router_factory->newInstance();

		$routes_file = $this->getAppResourcePath('config/routes.php');

		if (file_exists($routes_file)) {
			// Let the app specify it's own routes.
			include_once($routes_file);
		} else {
			// Fall back on some sensible defaults.
			$router->add(null, '/');
			$router->add(null, '/{controller}');
			$router->add(null, '/{controller}/{action}');
			$router->add(null, '/{controller}/{action}/{id}');
		}

		$this->router = $router;
	}
1234280
public function getRouteProperties($route, Request $request)
    {
        $uri = ltrim(isset($route['uri']) ? $route['uri'] : $request->getRequestUri(), '/');
        $methods = isset($route['methods']) ? $route['methods'] : (array) $request->getMethod();
        $action = (isset($route[1]) && is_array($route[1])) ? $route[1] : $route;

        if (in_array('GET', $methods) && ! in_array('HEAD', $methods)) {
            $methods[] = 'HEAD';
        }

        return [$uri, $methods, $action];
    }
1321737
@Override
    public String getReverseRouteFor(Controller controller, String method) {
        return getReverseRouteFor(controller.getClass(), method, null);
    }
663282
function Routing() {

    var self        = {};

    /**
     * @function getRoute
     *
     * @param {string} rule e.g.: <name>[@<bundle>]
     * @param {object} params
     *
     * @return {object} route
     * */
    self.getRoute = function(rule, params) {

        var config      = getContext('gina').config
            , bundle    = null;

        if ( /\@/.test(rule) ) {
            bundle = rule.split(/\@/)[1];
        } else {
            bundle    = config.bundle
        }

        var env     = config.env
        , routing   = config.getRouting(bundle, env);

        if ( typeof(routing[rule]) == 'undefined' ) {
            throw new Error('[ RoutingHelper::getRouting(rule, params) ] : `' +rule + '` not found !')
        }

        var route = JSON.parse(JSON.stringify(routing[rule]));
        var variable = null
        for (var p in route.param) {
            if ( /^:/.test(route.param[p]) ) {
                variable = route.param[p].substr(1);
                if ( typeof(params[variable]) != 'undefined') {
                    route.url = route.url.replace( new RegExp('(/:'+variable+'|/:'+variable+'$)', 'g'), '/'+ params[variable] );

                    if ( typeof(route.param.path) != 'undefined' && /:/.test(route.param.path) ) {
                        route.param.path = route.param.path.replace( new RegExp('(:'+variable+'/|:'+variable+'$)', 'g'), params[variable]);
                    }
                }
            }
        }

        if ( Array.isArray(route.url) ) {
            route.url = route.url[0]
        }

        return route

    };

    /**
     * Get route by url
     * N.B.: this will only work with rules declared with `GET` method property
     *
     * @function getRouteByUrl
     *
     * @param {string} url e.g.: /bundle/some/url/path or http
     * @param {string} [bundle] targeted bundle
     *
     * @return {object} route
     * */
    self.getRouteByUrl = function (url, bundle) {

        var matched         = false
            , pathname      = null
            , gnaCtx        = getContext('gina')
            , config        = gnaCtx.config
            , bundle        = ( typeof(bundle) != 'undefined' ) ? bundle : config.bundle
            , env           = config.env
            , router        = new gnaCtx.Router(env)
            , routing       = config.getRouting(bundle, env)
            , isRoute       = null
            , route         = null
            , isXMLRequest  = getContext().router.isProcessingXMLRequest
        ;

        var hostname    = config.envConf[bundle][env].hostname
            , uri       = config.envConf[bundle][env].server.webroot
            , prefix    = hostname + uri;

        pathname = url.replace( new RegExp('^'+ hostname), '');

        var request = {
            routing: {
                path: unescape(pathname)
            },
            method: 'GET',
            params: {}

        };

        out:
            for (var rule in routing) {
                if (typeof(routing[rule]['param']) == 'undefined')
                    break;

                if (routing[rule].bundle != bundle) continue;

                // this will only work with rules declared with `GET` method property
                if ( typeof(routing[rule].method) != 'undefined' && !/^get$/i.test(routing[rule].method) ) continue;

                //Preparing params to relay to the router.
                params = {
                    method              : routing[rule].method || 'GET',
                    requirements        : routing[rule].requirements,
                    namespace           : routing[rule].namespace || undefined,
                    url                 : unescape(pathname), /// avoid %20
                    rule                : routing[rule].originalRule || rule,
                    param               : routing[rule].param,
                    middleware          : routing[rule].middleware,
                    bundle              : routing[rule].bundle,
                    isXMLRequest        : isXMLRequest
                };

                //Parsing for the right url.
                try {
                    isRoute = router.compareUrls(request, params, routing[rule].url);
                } catch (err) {
                    throw new Error('Rule [ '+rule+' ] needs your attention.\n' + err.stack);
                    break;
                }

                if (isRoute.past) {

                    route = JSON.parse(JSON.stringify(routing[rule]));

                    matched = true;
                    isRoute = {};
                    break out;

                }
            }

        if (!matched) {
            throw new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle]) ] : route not found for url: `' + url + '` !')
        } else {
            return route
        }

    }

    return self
}