public function match(RequestInterface $request)
    {
        foreach ($this->routes as $name => $route) {
            if (!$route->match($request)) {
                continue;
            }

            foreach ($route->arguments() as $key => $value) {
                $request->query()
                    ->set($key, $value);
            }

            $request->language($request->query()->get('language'));
            $request->format($request->query()->get('format'));

            $request->route($name);

            $this->defaults = [
                'host' => $request->baseName(),
                'route' => $name,
                'language' => $request->language(),
                'format' => $request->format()
            ];

            return $route->controller();
        }

        throw new RouterException('Route for "' . $request->path() . '" not found!');
    }
public function match(RequestInterface $request)
    {
        foreach ($this->routes as $name => $route) {
            if (!$route->match($request)) {
                continue;
            }

            foreach ($route->arguments() as $key => $value) {
                $request->query()
                    ->set($key, $value);
            }

            $request->language($request->query()->get('language'));
            $request->format($request->query()->get('format'));

            $request->route($name);

            $this->defaults = [
                'host' => $request->baseName(),
                'route' => $name,
                'language' => $request->language(),
                'format' => $request->format()
            ];

            return $route->controller();
        }

        throw new RouterException('Route for "' . $request->path() . '" not found!');
    }
public function match ( RequestInterface $ request ) { foreach ( $ this -> routes as $ name => $ route ) { if ( ! $ route -> match ( $ request ) ) { continue ; } foreach ( $ route -> arguments ( ) as $ key => $ value ) { $ request -> query ( ) -> set ( $ key , $ value ) ; } $ request -> language ( $ request -> query ( ) -> get ( 'language' ) ) ; $ request -> format ( $ request -> query ( ) -> get ( 'format' ) ) ; $ request -> route ( $ name ) ; $ this -> defaults = [ 'host' => $ request -> baseName ( ) , 'route' => $ name , 'language' => $ request -> language ( ) , 'format' => $ request -> format ( ) ] ; return $ route -> controller ( ) ; } throw new RouterException ( 'Route for "' . $ request -> path ( ) . '" not found!' ) ; }
Matches request to route
Throws RangeException if no matching route found

@param RequestInterface $request

@return callable
@throws RouterException
Matches request to route Throws RangeException if no matching route found