src/Routing/Router.php
public function getRoute($name)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException("Route name not provided.");
        }

        // TODO: This is not very efficient, maybe find a better way
        foreach ($this->routes as $route) {
            if ($route->getName() === $name) {
                return $route;
            }
        }

        throw new \Exception("Route \"$name\" not found.");
    }
public function getRoute($name)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException("Route name not provided.");
        }

        // TODO: This is not very efficient, maybe find a better way
        foreach ($this->routes as $route) {
            if ($route->getName() === $name) {
                return $route;
            }
        }

        throw new \Exception("Route \"$name\" not found.");
    }
public function getRoute ( $ name ) { if ( empty ( $ name ) ) { throw new \ InvalidArgumentException ( "Route name not provided." ) ; } // TODO: This is not very efficient, maybe find a better way foreach ( $ this -> routes as $ route ) { if ( $ route -> getName ( ) === $ name ) { return $ route ; } } throw new \ Exception ( "Route \"$name\" not found." ) ; }
Returns a route by name.

@param  string $name
@return Route
@throws  \Exception If no route with given name is found.
@throws  \InvalidArgumentException If given name is empty.
Returns a route by name .