Given a request (such as $_SERVER['REQUEST_URI']) find the corresponding ResourceConfiguration object

@param mixed $route
@return ResourceConfiguration
963941
public function getResourceConfigurationFromRequest($route)
    {
        // get just the base url without query string
        $route = parse_url($route, PHP_URL_PATH);

        // remove any slashes from begining/end
        $route = trim($route, " /");

        // get the base resource excluding any single identifiers
        $parts = explode('/', $route);
        $resource = is_numeric(end($parts)) ? prev($parts):end($parts);

        return $this->resourceConfigurationFor($resource);
    }
520023
public function match(Request $request, $route = false)
    {
        if (count($this->_childs)) {
            $route = $this->_match($request, $route);
        }

        if (!$route) {
            $route = $this->_default($request)->merge($route);
        }


        if (!$route) {
            throw new RuntimeException("Missing route...");
        }

        return $route;
    }
68167
public function get($route = null)
    {
        //argument 1 must be a string or null
        Argument::i()->test(1, 'string', 'null');
        
        //if route is null
        if (is_null($route)) {
            //return all routes
            return $this->route;
        }
        
        //if valid route
        if ($this->valid($route)) {
            //return route
            return $this->route[strtolower($route)];
        }
        
        //at this point it is not a route
        //return the same thing
        return $route;
    }
459989
protected function _parse($route) {
		if (is_string($route)) {
			$this->_ensureHere();

			$url = parse_url($route);
			$_path = rtrim($url['path'], '/');
			if ($_path . '?' . Hash::get($url, 'query') === $this->_hereQuery) {
				return true;
			}

			if ($_path === $this->_here) {
				return true;
			}

			return false;
		}

		$count = count($route);
		if ($count == 0) {
			return false;
		}

		foreach ($route as $key => $value) {
			if (array_key_exists($key, $this->request->params)) {
				$values = (array)$value;
				$check = (array)$this->request->params[$key];

				$hasNullValues = (count($values) != count(array_filter($values)) || count($values) == 0);
				$currentValueIsNullish = (in_array(null, $check) || in_array('', $check) || count($check) == 0);
				if ($hasNullValues && $currentValueIsNullish) {
					$count--;
					continue;
				}

				if (in_array($key, array('controller', 'plugin'))) {
					foreach ($check as $k => $_check) {
						$check[$k] = Inflector::underscore(strtolower($_check));
					}
				} else {
					foreach ($check as $k => $_check) {
						$check[$k] = strtolower($_check);
					}
				}

				if (count($values) > 0) {
					foreach ($values as $k => $v) {
						if (in_array(strtolower($v), $check)) {
							$count--;
							break;
						}
					}
				} elseif (count($check) === 0) {
					$count--;
				}
			} elseif (is_numeric($key) && isset($this->request->params['pass'])) {
				if (is_array($this->request->params['pass'])) {
					if (Hash::contains($this->request->params['pass'], $value)) {
						$count--;
					}
				}
			}
		}

		return ($count == 0);
	}
532640
public function find(Request $request)
    {
        $route = $this->getRouteFinder()->find($request, $this->getRoutes());
        $this->setCurrentRoute($route);
        return $route;
    }
524797
protected function getRouteInformation(Route $route)
    {
        $methods = implode('|', $route->methods());

        return $this->filterRoute(array(
            'host'       => $route->domain(),
            'method'     => $methods,
            'uri'        => $route->uri(),
            'name'       => $route->getName(),
            'action'     => $route->getActionName(),
            'middleware' => $this->getMiddleware($route),
        ));
    }
575721
public function dispatch(Route $route)
    {
        $this->beforeStart();

        return $this->router->dispatch($route, $this->request);
    }
605441
public function addRoute(Route $route)
	{
		foreach ($route->getMethods() as $method)
		{
			$this->routes[$method][/*$route->uri*/] = $route;
		}
		
		$this->allRoutes[] = $route;

		return $this;
	}
285416
protected function getUrl($route, $params = array())
    {
        $urlHelper = $this->getView()->plugin('url');

        if ('#' === $route[0]) {
            return $route;
        }

        return $urlHelper($route, $params, $this->getRouteOptions());
    }
319265
public function route($request = NULL)
    {
        $matchedResource = NULL;
        if (!$request) {
            $request = new Request();
        }
        foreach ($this->resources as $className => $resourceMetadata) {
            foreach ($resourceMetadata->getUri() as $index => $uri) {
                $uriRegex = '|^'.$uri.'$|';
                if (
                    ($matchedResource == NULL || $matchedResource[0]->getPriority() < $resourceMetadata->getPriority())
                &&
                    preg_match($uriRegex, $request->getUri(), $params)
                ) {
                    array_shift($params);
                    $uriParams = $resourceMetadata->getUriParams($index);
                    if ($uriParams) { // has params within URI
                        foreach ($uriParams as $key => $name) {
                            $params[$name] = $params[$key];
                        }
                    }
                    $matchedResource = array($resourceMetadata, $params);
                }
            }
        }
        if ($matchedResource) {
            $request->setParams($matchedResource[1]);

            return $matchedResource[0];
        } else {
            throw new NotFoundException(sprintf('Resource matching URI "%s" not found', $request->uri));
        }
    }
353386
protected function getRegExpRoute($route)
    {
        return preg_replace_callback(
            '#(/?)\{(\S+?)(:(\S+?))?\}#',
            function (array $matches) {
                $startMod = $matches[1];
                $name = $matches[2];
                $type = isset($matches[4]) ? $matches[4] : 'string';

                $type = $this->getTypeRegexp($type);

                $regexp = $startMod . "(?P<$name>$type)";
                if (!$this->isRequiredParam($name)) {
                    $regexp = "({$regexp})?";
                }

                return $regexp;
            },
            $route
        );
    }
749322
public function dispatch(Route $route)
    {
        $callback = $route->getCallback();
        $params = array_values($route->getData());

        if ($callback instanceof Closure) {
            return $this->container->resolveClosure($callback, $params);
        }

        $class = $this->container->make($callback[0]);
        return $this->container->resolveMethod($class, $callback[1], $params);
    }
165833
private function getMiddleWareFromRoute(Route $route)
    {
        if (!$route->group) {
            return $route->middleWare;
        }
        $groupMiddleWare = $this->getMiddleWareFromGroup($route->group);
        return \array_merge($groupMiddleWare, $route->middleWare);
    }
1160379
public function getControllerFromRoute(Route $route)
    {
        $ret = false;
        $actionParts = explode(':', $route->getDefault('_controller'));

        if (count($actionParts) == 2) {
            $ret = $this->container->get($actionParts[0]);
        }

        return $ret;
    }
309334
public function createController($route)
    {
        preg_match('/(default)/', $route, $match);
        if (isset($match[0]))
            return parent::createController($route);

        return parent::createController("{$this->defaultRoute}/{$route}");
    }
152400
public function getRunner(Route $route)
    {
        if (isset($route->controller)) {
            $class = Runner\Controller::class;
        } elseif (isset($route->fn)) {
            $class = Runner\Callback::class;
        } elseif (isset($route->file)) {
            $class = Runner\PhpScript::class;
        } else {
            trigger_error("Route has neither 'controller', 'fn' or 'file' defined", E_USER_NOTICE);
            return null;
        }

        return new $class();
    }
1343533
public function getController($route = null)
		{
		    $router = $this->init($route == null)->router;
			return $route
                ? $router->getController($route)
                : $router->getControllers();
		}