Redirect to controller

@param  string $module
@param  string $controller
@param  array  $params

@return void
@throws RedirectException
422493
public static function redirectTo($module, $controller = 'index', array $params = []): void
    {
        $url = Router::getFullUrl($module, $controller, $params);
        self::redirect($url);
    }
535339
public static function execute($controller, $request) {   
        switch($request->method()) { 
            case 'POST':
                $data = $controller->store($request->bodyRequest());
                KernelHttp::makeResponse('201', $data);
                break;
            case 'PUT':
                $data = $controller->update($request->bodyRequest());
                KernelHttp::makeResponse('200', $data);
                break;
            case 'DELETE':
                $controller->destroy($request->getInteractionsRequest());
                KernelHttp::makeResponse('200');
                break;
            default: 
                $request->getRequiredParameter() ? $data = $controller->show($request->getInteractionsRequest()) : $data = $controller->index($request->getInteractionsRequest()); 
                KernelHttp::makeResponse('200', $data);
                break;
        } 
    }
161361
protected <T extends Controller> void redirect(Class<T> controllerClass){
        redirect(controllerClass, new HashMap<String, String>(0));
    }
692621
public function getController($module, $controller=null, $type="controller")
	{
	    if (isset($this->controllers[$module])) {
	        $controller = $this->controllers[$module];
	    } else {
	        $controller = parent::getController($module, $controller, $type);
	        if (!$controller) {
	            throw new \InvalidArgumentException(sprintf('The controller "%s" does not exist.', $module));
	        }
	    }
	    
	    if ($this->needHelps) {
	        $this->needHelps = false;
	        
	        /** @var \Wslim\Console\Controller\HelpController $helpController */
	        $helpController = $this->getController('help');
	        $helpController->setController($controller);
	        
	        return $helpController;
	    }
	    
	    return $controller;
	}
315885
public function setController(Controller $controller)
    {
        $this->links->controller = $controller;
        $this->twig->addGlobal('controller', $this->links->controller);
    }
677568
protected function bindToModule($request, $url, $controller)
    {
        $array  = explode('|', $url, 2);
        $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
        $param  = [];

        if (!empty($array[1])) {
            $this->parseUrlParams($request, $array[1], $param);
        }

        return new ModuleDispatch($request, $this, $controller . '/' . $action, $param);
    }
1237165
private function executeController($controller, Route $method, $matches) {

		if(false === is_object($controller)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type object, "%s" given', __METHOD__, gettype($controller)), E_USER_ERROR);
		}

		if(false === is_array($matches)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($matches)), E_USER_ERROR);
		}

		//Load the module dispatch file if exists and readable
		$this -> loadBoot($method -> getModule());

		//Execute start method if controller supports it
		if(true === is_callable([$controller, '__start'])) {
			call_user_func_array([$controller, '__start'], []);
		}

		//Execute main function
		$action = Application :: get(['prefix', 'action']) . $method -> getAction();

		//Trigger error if main function does not exists
		if(false === is_callable([$controller, $action])) {
			return trigger_error(sprintf('Method "%s" does not exists in "%s" controller', Application :: get(['prefix', 'action']) . ucfirst($method -> getAction()), $method -> getController()), E_USER_ERROR);
		}

		call_user_func_array([$controller, $action], $matches);

		//Execute end method if controller supports it
		if(true === is_callable([$controller, '__end'])) {
			call_user_func_array([$controller, '__end'], []);
		}
	}
876829
public function addMap($method, $module, $controller): Link
    {
        return $this->map[strtoupper($method)] = new Link($module, $controller);
    }
273270
public function redirectToRoute($route, $parameters = [], $status = 302, $headers = [])
    {
        respondWith(response()->redirectToRoute($route, $parameters, $status, $headers));
    }
359491
protected function redirect(Response $response, $route, array $params = [])
    {
        return $response->withRedirect($this->container['router']->pathFor($route, $params));
    }
372819
final public function getOutput($module, $controller, $action, array $params = array(), $partial = true) {
        $view = new View();
        $controllerClass = ucfirst(\Util::hyphenToCamel($module)) . '\Controllers\\' . ucfirst(\Util::hyphenToCamel($controller)) . 'Controller';
        $controllerClass = new $controllerClass;
        $controllerClass->setView($view);
        $action = lcfirst(\Util::hyphenToCamel($action));
        $view->setController($controllerClass)
                ->setAction(lcfirst(\Util::hyphenToCamel($action)))
                ->setModule(ucfirst(\Util::hyphenToCamel($module)));
        $actionRet = call_user_func_array(array($controllerClass, $action . 'Action'), $params);
        if (is_object($actionRet) && is_a($actionRet, 'DScribe\View\View')) {
            $view = $actionRet;
        }
        else {
            $view->variables(($actionRet) ? $actionRet : array());
        }
        if ($viewFile = $view->getViewFile(false)) {
            if (!isset($viewFile[0]) && !isset($viewFile[1])) {
                $view->file($module, $controller, $viewFile[2]);
            }
            else if (!isset($viewFile[0])) {
                $view->file($module, $viewFile[1], $viewFile[2]);
            }
        }
        else {
            $view->file($module, $controller, $action);
        }

        if ($partial) {
            $view->partial();
        }

        ob_start();
        $view->render();
        return ob_get_clean();
    }
987348
protected function redirectAction ($action, $params=array())
    {
        // Get controller public name
        $ctrlPubName = \Teon\Base\Stdlib\ClassUtils::getPublicControllerName(get_class($this));

        // Get original parameters
        $paramsOrig = $this->params()->fromRoute();

        // Combine parameters - if action is explicitly specified in params it is overriden
        $params2pass = array_merge(
            $paramsOrig,
            $params,
            array('action' => $action)
        );

        // Do the redirect
        return $this->redirect()->toRoute($ctrlPubName, $params2pass);
    }
290283
public function register_router_controller($router, $params, $controller)
    {
        if (!is_array($params)) {
            $params = array($params);
        }
        $route = $params[0];
        $method = isset($params[1]) ? $params[1] : 'GET|POST';
        $name = isset($params[2]) ? $params[2] : $controller;
        if (in_array($name, $this->controllers_routes)) {
            $name = null;
        } else {
            $this->controllers_routes[] = $name;
        }
        $this->controllers_url_routes[] = $controller . ' ' . $route . ' [' . $method . ']';
        if(!isset(self::$routes[$name])) {
            $router->map($method, $route, array($this, $controller), $name);
            self::$routes[$name] = true;
        } else {
            $router->map($method, $route, array($this, $controller));

        }
    }
64345
public function setSuccessRedirect(\Zend\Mvc\Controller\Plugin\Redirect $redirect, $route, $params = []) {
		$this->redirect = $redirect;
		$this->redirectRoute = $route;
		$this->params = $params;
	}
1313420
public function loadController($module, $controller) {

		if(false === is_string($module)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($module)), E_USER_ERROR);
		}

		if(false === is_string($controller)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($controller)), E_USER_ERROR);
		}

		$folders 	= explode('.', $controller); //Convert dots to directory separators
		$amount 	= count($folders) - 1;
		$namespace	= '';

		foreach($folders as $index => $folder) {

			if($amount === $index) {
				
				$controller = Application :: get(['prefix', 'controller']) . $folder;
				$namespace .= $controller;

				break;
			}

			$namespace 	.= $folder . DIRECTORY_SEPARATOR;
		}

		$controller = str_replace(DIRECTORY_SEPARATOR, '\\', $module . DIRECTORY_SEPARATOR . Application :: get(['directory', 'controller']) . $namespace);
			
		return $controller;
	}
322960
protected function urlCustom($module, $controller, $params): string
    {
        $url = $this->reverse[$module][$controller]['route'];

        $getParams = [];
        foreach ($params as $key => $value) {
            // sub-array as GET params
            if (\is_array($value)) {
                $getParams[$key] = $value;
                continue;
            }
            $url = str_replace('{$' . $key . '}', $value, $url, $replaced);
            // if not replaced, setup param as GET
            if (!$replaced) {
                $getParams[$key] = $value;
            }
        }
        // clean optional params
        $url = preg_replace('/\{\$[a-z0-9-_]+\}/i', '', $url);
        // clean regular expression (.*)
        $url = preg_replace('/\(\.\*\)/', '', $url);
        // replace "//" with "/"
        $url = str_replace('//', '/', $url);

        if (!empty($getParams)) {
            $url .= '?' . http_build_query($getParams);
        }
        return $this->getBaseUrl() . ltrim($url, '/');
    }
1165841
public static function setMCA(string $module, string $controller, string $action): void
    {
        self::$module = $module;
        self::$controller = $controller;
        self::$action = $action;
    }