Set the controller as Resource Controller
Cygnite Router knows how to respond to resource controller
request automatically.

@param $router
@param $name
@param $controller

@return $this
320232
public function resourceController($router, $name, $controller)
    {
        $this->setRouter($router);

        foreach ($this->resourceRoutes as $key => $action) {
            $this->{'setResource' . ucfirst($action)}($name, $controller, $action);
        }

        return $this;
    }
242883
public function initCron($src, $controller, $action) {
        if (!Config::config()['user']['debug']['maintenance']) {
            $this->_routeCron($src, $controller, $action);

            if ($this->_route == true) {
                $this->_setFunction($this->request->src);
                $this->_setEvent($this->request->src);
            }
        }
    }
191397
private function createResourceController(
        Generator $generator,
        $prefix,
        $controller,
        $model_namespace = ''
    ) {
        $generator->write('controller/rest', [
            'modelNamespace' => $model_namespace,
            'prefix' => $prefix,
            'baseNamespace' => $this->namespaces['controller']
        ]);

        echo Color::green('The controller Rest was well created.');
    }
262350
protected function setController(
        Router\DataStructures\Controller $controller,
        array $uriSegments = []
    ) {
        if ( ! $controller->isValid()) {
            output()->sendError(400);
        }

        // Add Controller PSR4 Namespace
        loader()->addNamespace($controller->getNamespaceName(), $controller->getFileInfo()->getPath());

        $controllerMethod = $controller->getRequestMethod();
        $controllerMethod = empty($controllerMethod) ? reset($uriSegments) : $controllerMethod;
        $controllerMethod = camelcase($controllerMethod);

        // Set default controller method to index
        if ( ! $controller->hasMethod($controllerMethod) &&
            ! $controller->hasMethod('route')
        ) {
            $controllerMethod = 'index';
        }

        // has route method, controller method set to index as default
        if (empty($controllerMethod)) {
            $controllerMethod = 'index';
        }

        if (camelcase(reset($uriSegments)) === $controllerMethod) {
            array_shift($uriSegments);
        }

        $controllerMethodParams = $uriSegments;

        if ($controller->hasMethod('route')) {
            $controller->setRequestMethod('route');
            $controller->setRequestMethodArgs([
                $controllerMethod,
                $controllerMethodParams,
            ]);
        } elseif ($controller->hasMethod($controllerMethod)) {
            $method = $controller->getMethod($controllerMethod);

            // Method doesn't need any parameters
            if ($method->getNumberOfParameters() == 0) {
                // But there is parameters requested
                if (count($controllerMethodParams)) {
                    output()->sendError(404);
                } else {
                    $controller->setRequestMethod($controllerMethod);
                }
            } else {
                $parameters = [];

                if (count($controllerMethodParams)) {
                    if (is_numeric(key($controllerMethodParams))) {
                        $parameters = $controllerMethodParams;
                    } else {
                        foreach ($method->getParameters() as $index => $parameter) {
                            if (isset($uriSegments[ $parameter->name ])) {
                                $parameters[ $index ] = $controllerMethodParams[ $parameter->name ];
                            } else {
                                $parameters[ $index ] = null;
                            }
                        }
                    }
                }

                $controller->setRequestMethod($controllerMethod);
                $controller->setRequestMethodArgs($parameters);
            }
        }

        // Set Controller
        services()->add($controller, 'controller');
    }
856137
protected function makeController($controller)
	{
		Controller::setRouter($this->router);

		return $this->container->make($controller);
	}
176622
protected function setResourceDelete($name, $controller, $action, $options = [])
    {
        return $this->mapResource('delete', $name . '/(\d+)/', $controller, $action, true);
    }
826801
public function initController($controller, $path)
    {
        if($path)
        {
            $controller = $this->name . '\\Controller\\' . $path . '\\' . $controller;
        }
        else
        {
            $controller = $this->name . '\\Controller\\' . $controller;
        }

        return new $controller();
    }
510076
public function patch($name, $path, $controller = null)
    {
        $this->add('PATCH', $name, $path, $controller);
        return $this;
    }
1240276
public function alias($template, $name, $to)
	{
		$router = $this;
		return $this->connect($template, $name, function($request) use($router, $to) {
			return $router->controller($to)->execute($request);
		});
	}
183262
protected function setResourceShow($name, $controller, $action, $options = [])
    {
        return $this->mapResource('get', $name . '/(\d+)', $controller, 'get' . ucfirst($action), true);
    }
454764
public function setHeaderController($headerController)
    {
        if(! $headerController instanceof Asset\HeaderSetter) {
            throw new ErrorException('Header controller must be an instance of Asset\HeaderSetter.');
        }

        $this->headerController = $headerController;

        return $this;
    }
1236764
public function startup(Controller $controller) {
		if ($this->settings['isTest']) {
			return;
		}

		foreach ($this->routes as $route) {
			if (!$this->_parse($route['route'])) {
				continue;
			}

			if (!$this->_execute($route)) {
				break;
			}

			$this->Session->write('Sanction.referer', $this->request->here());
			return $this->redirect($controller, $route);
		}
	}
973453
public function setController($controller, $name = null)
    {
        $controller = $this->app->normalizeClassName($controller, 'Controller');

        return $this->add($controller, $name);
    }
931098
public function setController(){
		
		//explode the metaData into controller and method
		$routeMetaDataArray = ArrayHelper::parts($this->pattern, $this->routeMetaData)->clean()->trim()->get();

		//check if  a controller is defined for this route
		try{

			if ( ! (int)ArrayHelper::KeyExists(0, $routeMetaDataArray)->get() || empty($routeMetaDataArray[0])) {

				throw new RouteException(get_class(new RouteException) ." : There is no controller associated with this route! -> " . $this->routeName);
				
			}

			//set the controller for this route
			$this->controller = $routeMetaDataArray[0];

			//set the method meta data
			$this->methodMetaData = (count($routeMetaDataArray) > 1) ? $routeMetaDataArray[1] : null;

			//return this object instance
			return $this;

		}
		catch(RouteException $RouteExceptionObjectInstance){

			//display the error message
			$RouteExceptionObjectInstance->errorShow();

		}

	}
93047
public function setController($controller) {
        $controller = Str::studly($controller);
        if('Controller' != substr($controller, -10)) {
            $controller = $controller . 'Controller';
        }

        $this->controller = $controller;

        return $this;
    }
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.");
    }
356699
private function setResourceMethods($url, $controller)
    {

        //index
        $this->setIndexResource($url, '', $controller);

        $url = ($url == '/') ? '' : $url;

        $this->setIndexResource($url, '/index', $controller);

        //show
        $this->setShowResource($url, '/show/{param}', $controller);

        //add
        $this->setAddResource($url, '/add', $controller);

        //insert
        $this->setInsertResource($url, '/insert', $controller);

        //edit
        $this->setEditResource($url, '/edit/{param}', $controller);

        //update
        $this->setUpdateResource($url, '/update', $controller);
        $this->setUpdateResource($url, '/update/{param}', $controller);

        //delete
        $this->setDeleteResource($url, '/delete/{param}', $controller);
    }