Inject a defaultRoute.

@param string $controller
@param string $action
@param array $args
492758
public function defaultRoute($controller, $action = null, array $args = [])
    {
        $this->_defaultRoute = [
            'route' => implode('/', [$this->module->id, $controller, (empty($action)) ? 'index' : $action]),
            'args' => $args,
            'originalArgs' => $args,
        ];
    }
788880
private function createRoute(ReflectionMethod $routable, $path, $controller)
    {
        $verb = $this->getVerb($routable->name);

        $uri = $this->getUri($routable, $path);

        return 'Route::'."$verb('$uri', '$controller@{$routable->name}');\n";
    }
506881
protected function configureAction($action,array $arguments = array()){
        $this->setProperty(self::PROPERTY_HTTP_METHOD,$this->actions[$action]);
    }
856367
public function runController($controller = null, $action = null, $values = array())
    {
        if($action != null && method_exists($controller, $action))
        {
            if($values != null)
            {
                call_user_func_array(array($controller, $action), $values);
            }
            else
            {
                $controller->{$action}();
            }
        }
        else
        {
            $controller;
        }
    }
961438
public function setAction(Controller $controller, $action = 'execute')
    {
        $this->controller = $controller;
        $this->action = $action;
    }
1351987
protected function setIndexRoute($controller, $action): Controller
    {
        $this->routes['get'] = [
            "/$controller/" => Inflector::classify($controller) . '@' . $action,
            "/$controller/$action/{:id}" => Inflector::classify($controller) . '@' . $action,
            "/$controller/$action/" => Inflector::classify($controller) . '@' . $action,
        ];

        return $this;
    }
1054063
protected function addFilters(Controller $controller, $action, Request $request, Route $route=null) {
		$controllerClass = get_class($controller);

		foreach($this->filters as $_filter) {
			$args = $_filter['args'];
			$filter = $_filter['filter'];

			if(isset($criteria)) {
				$criteria = $_filter['criteria'];
				if(isset($criteria['actions'])) {
					if(!is_string($action))
						continue;
					if($criteria['actions'] && strpos($controllerClass.':'.$action, $criteria['actions']) !== 0)
						continue;
				}
				if($route !== null && isset($criteria['route'])) {
					foreach($criteria['methods'] as $method) {
						if($criteria['route'] && strpos($route->getRoute(), $criteria['route']) !== 0 || strtoupper($method) !== $request->method())
							continue;
					}
				}
			}

			$reflector = new \ReflectionClass($filter);
			$controller->addFilter($reflector->newInstanceArgs($args));
		}

		foreach($this->beforeFilters as $_filter) {
			$filter = $_filter['filter'];

			if(isset($criteria)) {
				$criteria = $_filter['criteria'];
				if(isset($criteria['actions'])) {
					if(!is_string($action))
						continue;
					if($criteria['actions'] && strpos($controllerClass.':'.$action, $criteria['actions']) !== 0)
						continue;
				}
				if($route !== null && isset($criteria['route'])) {
					foreach($criteria['methods'] as $method) {
						if($criteria['route'] && strpos($route->getRoute(), $criteria['route']) !== 0 || strtoupper($method) !== $request->method())
							continue;
					}
				}
			}

			$controller->addBeforeFilter($filter);
		}

		foreach($this->afterFilters as $_filter) {
			$filter = $_filter['filter'];

			if(isset($criteria)) {
				$criteria = $_filter['criteria'];
				if(isset($criteria['actions'])) {
					if($criteria['actions'] && strpos($controllerClass.':'.$action, $criteria['actions']) !== 0)
						continue;
				}
				if($route !== null && isset($criteria['route'])) {
					foreach($criteria['methods'] as $method) {
						if($criteria['route'] && strpos($route->getRoute(), $criteria['route']) !== 0 || strtoupper($method) !== $request->method())
							continue;
					}
				}
			}

			$controller->addAfterFilter($filter);
		}
	}
401895
protected function buildDestination($controller, $action, array $args = array())
    {
        if (!isset($this->reverseMapping[$controller][$action])) {
            throw new Exception("Route mapping not found for controller '{$controller}', action '{$action}'");
        }

        /**
         * @var Route\Mapping $mapping
         */
        $mapping = $this->reverseMapping[$controller][$action];
        $destinationPattern = $mapping->destinationPattern();
        foreach ($args as $argName => $argValue) {
            $destinationPattern = str_replace("{{$argName}}", $argValue, $destinationPattern, $count);
            if ($count < 1) {
                throw new Exception("Provided argument '{$argName}' doesn't match any URL wildcard");
            }
        }

        return $destinationPattern;
    }
256594
private function addRoute($method, $pattern, $action)
    {

        if (is_array($method)) {
            foreach ($method as $verb) {
                $this->routes[$verb . $pattern] = ['method' => $verb, 'uri' => self::patternFactory($pattern), 'action' => $action];
            }
        } else {
            $this->routes[$method . $pattern] = ['method' => $method, 'uri' => self::patternFactory($pattern), 'action' => $action];
        }
    }
1144471
public function addRoute($methods, $uri, $action)
    {
        if (is_string($action)) {
            $action = ['uses' => $action];
        } elseif ($action instanceof Closure) {
            $action = [$action];
        }

        $action = $this->mergeLastGroupAttributes($action);

        $uri = $uri === '/' ? $uri : '/'.trim($uri, '/');

        if (! empty($action['prefix'])) {
            $uri = '/'.rtrim(trim($action['prefix'], '/').'/'.trim($uri, '/'), '/');

            unset($action['prefix']);
        }

        $action['uri'] = $uri;

        $action = $this->addRouteMiddlewares($action);

//        echo $action;
//        return $this->adapter->addRoute((array) $methods, $action['version'], $uri, $action);
        return $this->addRoute((array) $methods, $action['version'], $uri, $action);
    }
336614
@Bind(aggregate = true, optional = true)
    public synchronized void bindController(Controller controller) {
        LOGGER.info("Adding routes from " + controller);

        List<Route> newRoutes = new ArrayList<>();
        try {

            List<Route> annotatedNewRoutes = RouteUtils.collectRouteFromControllerAnnotations(controller);
            newRoutes.addAll(annotatedNewRoutes);
            newRoutes.addAll(controller.routes());

            //check if these new routes don't pre-exist
            ensureNoConflicts(newRoutes);

        } catch (RoutingException e) {
            LOGGER.error("The controller {} declares routes conflicting with existing routes, " +
                    "the controller is ignored, reason: {}", controller, e.getMessage(), e);
            // remove all new routes as one has failed
            routes.removeAll(newRoutes);  //NOSONAR
        } catch (Exception e) {
            LOGGER.error("The controller {} declares invalid routes, " +
                    "the controller is ignored, reason: {}", controller, e.getMessage(), e);
            // remove all new routes as one has failed
            routes.removeAll(newRoutes); //NOSONAR
        }
    }
575001
public function performAction($controller, $action) {
		// Replace namespace with directory separator
		$controllerFile = str_replace("\\", DIRECTORY_SEPARATOR, $controller);

		// Check if controller exists
		if ( false == is_file( $controllerLocation = APP . 'Controllers/' . $controllerFile . '.php' ) )
			throw new ControllerNotFoundException();

		// Include and init the controller
		$controllerClass = "\\Application\\Controllers\\{$controller}";
		$controllerObj = new $controllerClass($this);

		// Check if the action exists
		if ( 'Errors' != $controller && false == method_exists($controllerObj, $action.= "Action" ) )
			throw new ActionNotFoundException();
		// Check if the error display action exists
		elseif ( $controller == $this->defaultRoute['_controller'] && false == method_exists($controllerObj, $action = "display" . $action ) )
			throw new ErrorActionNotFoundException();

		// Run the action
		$data = $controllerObj->{$action}();

		// Data fetching
		if ( false === $controllerObj->__returnActionPerformed ):
			// Format returned data
			if ( false == is_array( $data ) )
				$data = (array) $data;

			// Start reflection for data loading
			$ref = new \ReflectionObject($controllerObj);
			$properties = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
			$controllerData = array();

			// Get public data
			foreach ( $properties as $property ):
				// Don't add internal variabels
				if ( '__returnActionPerformed' == $property->getName() )
					continue;

				// Add property to controller data
				$controllerData[$property->getName()] = $property->getValue($controllerObj);
			endforeach;

			// Merge data from controller and action
			$data = array_merge($controllerData, $data);
		endif;

		// Return the object
		return $data;
	}
1250250
protected function registerRoute($method, $uri, $action = null)
    {
        if (! is_array($action)) {
            $action = array_merge($this->attributes, $action ? ['uses' => $action] : []);
        }

        return $this->router->{$method}($uri, $this->compileAction($action));
    }
1242067
public function callAction($action, $defaultAction = 'request') {
		if (method_exists($this, $action)) return $this->{$action}();
		else return $this->{$defaultAction}();
	}
270129
public function add($rule, $action = null)
    {
        $route = $this->di->get('route');
        $route->set($rule, $action);
        $this->routes[] = $route;

        // Set as default route
        if ($rule == "*") {
            $this->defaultRoute = $route;
        }
        
        return $route;
    }
873530
public function defaultTemplate ($module, $controller, $action)
	{

		// Start template path with the controller module

		$template	= $module? $module . '/' : '';

		// Add the controller path and convert \ to /

		$template	.= $controller? str_replace ('\\', '/', $controller) . '/': '';

		// If there is no template file yet just use the action

		$template	.= $action;

		// Lowercase and add tpl extension

		$template	= strtolower ($template) . '.tpl';

		// Return template

		return $template;

	}
1129951
public function addRoute( $uri, $controller_action )
    {
        $routeOptions = [];
        $routeOptions["uri"] = $uri;
        $routeOptions["controller_action"] = $controller_action;

        $routeDefinition = function() use ($routeOptions) {
            return $this->_createRoute( $routeOptions );
        };

        $this->_routeDefinitions[] = $routeDefinition;
    }