private function fallBackRoute(RequestInterface $request) : Route
    {
        $parts = explode('/', $request->getPathInfo());

        if (count($parts) == 2 && empty($parts[1])) {
            return $this->getDefaultRoute($request);
        }
        $actionName = 'index';

        $controllerName = ucfirst($parts[1]);
        if (count($parts) > 2) {
            $actionName = $parts[2];
        }
        
        $endPoint = new RouteEndpoint(
            $this->context->getControllerNamespace(),
            $controllerName,
            $actionName,
            $request->getMethod());
        
        return new Route('/' . $parts[1] . '/' . $actionName, $endPoint);
    }
private function fallBackRoute(RequestInterface $request) : Route
    {
        $parts = explode('/', $request->getPathInfo());

        if (count($parts) == 2 && empty($parts[1])) {
            return $this->getDefaultRoute($request);
        }
        $actionName = 'index';

        $controllerName = ucfirst($parts[1]);
        if (count($parts) > 2) {
            $actionName = $parts[2];
        }
        
        $endPoint = new RouteEndpoint(
            $this->context->getControllerNamespace(),
            $controllerName,
            $actionName,
            $request->getMethod());
        
        return new Route('/' . $parts[1] . '/' . $actionName, $endPoint);
    }
private function fallBackRoute ( RequestInterface $ request ) : Route { $ parts = explode ( '/' , $ request -> getPathInfo ( ) ) ; if ( count ( $ parts ) == 2 && empty ( $ parts [ 1 ] ) ) { return $ this -> getDefaultRoute ( $ request ) ; } $ actionName = 'index' ; $ controllerName = ucfirst ( $ parts [ 1 ] ) ; if ( count ( $ parts ) > 2 ) { $ actionName = $ parts [ 2 ] ; } $ endPoint = new RouteEndpoint ( $ this -> context -> getControllerNamespace ( ) , $ controllerName , $ actionName , $ request -> getMethod ( ) ) ; return new Route ( '/' . $ parts [ 1 ] . '/' . $ actionName , $ endPoint ) ; }
If we cannot match a Route with the RouteCollection
we will try to find a Controller & Action that matches the uri

@param RequestInterface $request
@return Route
If we cannot match a Route with the RouteCollection we will try to find a Controller & Action that matches the uri