Set a resource routes.

@param string $url
@param string $route
@param string $controller

@return null
192927
private function setResource($url, $route, $controller, $target)
    {
        $url = $url.$route;

        $route = new self($url);

        $closure = $this->getResourceClosure($controller, $target);

        $route->setClosure($closure);
        $route->setMethod('resource');
        $route->setTarget($controller, $target);

        $this->addResource($route);

        $route->add();

        return $route;
    }
631627
protected function setEditRoute($controller, $action): Controller
    {
        $callTo = Inflector::classify($controller) . '@' . $action;

        $this->routes['get'] = array_merge($this->routes['get'], [
            "/$controller/$action/{:id}/" => $callTo,
        ]);

        $this->routes['post'] = array_merge($this->routes['post'], [
            "/$controller/$action/" => $callTo,
        ]);
        
        $this->routes['post'] = array_merge($this->routes['post'], [
            "/$controller/$action/{:id}/" => $callTo,
        ]);

        return $this;
    }
1063262
public function dispatch( Route $route, Request $request, $controller, $method )
	{
		$instance = $this->makeController( $controller );

		return $this->callWithinStack( $instance, $route, $request, $method );
	}
892829
public function put(string $uri, string $controller, string $action)
    {
        $this->addRoute('PUT', $uri, $controller, $action);
    }
1162572
public function makeController($controller)
    {
        $namespace = $this->router->getNamespace();

        $classname = "{$namespace}\\{$controller}";

        if (class_exists($classname)) {
            return $this->container->make($classname);
        }

        throw new RoutingException("Controller [{$classname}] do not exists.");
    }
1060493
public function websocket(string $uri, string $controller)
    {
        $this->addRoute('WEBSOCKET', $uri, $controller, null);
    }
134750
public function dispatch(Route $route, Request $request, $controller, $method)
	{
		// First we will make an instance of this controller via the IoC container instance
		// so that we can call the methods on it. We will also apply any "after" filters
		// to the route so that they will be run by the routers after this processing.
		$instance = $this->makeController($controller);

		$this->assignAfter($instance, $route, $request, $method);

		$response = $this->before($instance, $route, $request, $method);

		// If no before filters returned a response we'll call the method on the controller
		// to get the response to be returned to the router. We will then return it back
		// out for processing by this router and the after filters can be called then.
		if (is_null($response))
		{
			$response = $this->call($instance, $route, $method);
		}

		return $response;
	}
499677
protected function callController($controller, $action, $route)
    {
        $controllers = $this->setting->getAsArray('auth.controller');
        $exclude = ($this->setting['auth.mode'] == 'exclude');
        $level = $this->setting->get('auth.level', 0);
        $inner = in_array($controller, $controllers);
        if ($exclude xor $inner) {
            if (!\Staq::Ctrl('Auth')->isLogged()) {
                throw new \Stack\Exception\MustBeLogged();
            }
            $user = \Staq::Ctrl('Auth')->currentUser();
            if ($user->hasAttribute('right')){
                if ($user->getAttribute('right')->getSeed() < $level) {
                    throw new \Stack\Exception\NotAllowed();
                }
            }
        }
        $result = parent::callController($controller, $action, $route);
        return $result;
    }
7297
private function _routeCron($src, $controller, $action) {
        $this->request->name = '-' . $src . '_' . $controller . '_' . $action;
        $this->request->src = $src;
        $this->request->controller = $controller;
        $this->request->action = $action;
        $this->request->auth = new Auth($this->request->src);
        $this->_route = true;
    }
162625
public function setController(string $controller): RouteInterface
   {
       if (!preg_match(
               "/^([A-Z]{1}[a-zA-Z_0-9]{1,31}(\/{1})?){1,3}$/",
               $controller)) {
           throw new InvalidArgumentException(
               "Can't set controller: invalid relative controller class name "
             . $controller);
       }
       $this->controller = rtrim($controller, "/");
       return $this;
   }
601100
private static function bind($url, $controller, array $definition, array $where)
    {
        $path = '/'.trim($url.$definition['url'], '/');

        // Launch of the route mapping method.
        $route = static::$application->{$definition['method']}(
            $path,
            sprintf("%s@%s", $controller, $definition['call'])
        );

        // Add name on the road
        $name = str_replace('/', '.', $url).'.'.$definition['call'];

        $route->name($name);

        // Association of defined criteria
        if (isset($where[$definition['call']])) {
            $route->where((array) $where[$definition['call']]);
        } else {
            $route->where((array) $where);
        }
    }
569770
public function setController($controller)
        {
            if (null !== $controller && !is_string($controller)) {
                throw new Exception(
                    'Invalid argument: $controller must be a string or null'
                );
            }

            $this->_controller = $controller;
            $this->_hrefCache  = null;

            return $this;
        }
560181
public function resource($uri, $controller, array $options = [])
    {
        $this->get($uri, "$controller@index", $options);
        $this->post($uri, "$controller@store", $options);
        $this->get("$uri/{placeholder}", "$controller@show", $options);
        $this->put("$uri/{placeholder}", "$controller@update", $options);
        $this->delete("$uri/{placeholder}", "$controller@delete", $options);
    }
719701
public function all(string $uri, string $controller, string $action)
    {
        $this->addRoute('ALL', $uri, $controller, $action);
    }
166862
public function dispatch(Route $route, $controller, $method)
    {

        // This is not very nice but with the current structure we have to throw
        // the previously created controller away.
        // For further implementations more cleanup has to be done
        $instance = $this->makeController(is_object($controller) ? get_class($controller) : $controller);

        $parameters = $this->resolveClassMethodDependencies(
            $route->parametersWithoutNulls(), $instance, $method
        );

        if ($this->creator && method_exists($this->creator, 'modifyMethodParameters')) {
            $this->creator->modifyMethodParameters($instance, $method, $parameters);
        }

        if (method_exists($instance, 'callAction')) {
            return $instance->callAction($method, $parameters);
        }

        return $instance->{$method}(...array_values($parameters));

    }
856137
protected function makeController($controller)
	{
		Controller::setRouter($this->router);

		return $this->container->make($controller);
	}
1211720
public function add($uri, $method, $controller, $action) {
        $this->currentRoute = [
            'uri' => $uri,
            'method' => $method,
            'controller' => $controller,
            'action' => $action,
            'module' => $this->module,
        ];

        if ($this->currentGroupName) {
            $this->virtualRoutes[$this->currentGroupName][] = $this->currentRoute;
        } else {
            $this->virtualRoutes['*'][] = $this->currentRoute;
        }

        return $this;
    }