Sets Contorller

@param   string  $controller     Name of the controller to call by Route
@return  Route
@throws  InvalidArgumentException
489176
public function setController($controller)
    {
        if (empty($controller)) {
            throw new InvalidArgumentException(sprintf('Missing controller for route with path "%s".', $this->getPath()));
        }

        $this->controller = $controller;

        return $this;
    }
583434
public function setMethod($method)
    {
        $method = strtoupper($method);
        if (!defined('static::METHOD_' . $method) && !$this->getAllowCustomMethods()) {
            throw new \InvalidArgumentException('Invalid HTTP method passed');
        }
        $this->method = $method;
        return $this;
    }
95120
protected function bindToController($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 ControllerDispatch($request, $this, $controller . '/' . $action, $param);
    }
1075678
public static function registerRoute($controller, $parameters = [])
    {
        \Route::group($parameters, function ($controller) {
            \Route::registerController($controller);
        });
    }
661272
public static function build($controller)
    {
        $routes = array();
        $actions = self::parseActionMethods($controller);

        foreach ($actions as $actionName => $actionInfo) {
            list($annotations, $meta) = $actionInfo;

            if (isset($annotations['Route'])) {
                $path = $annotations['Route'];
            } else {
                if ($actionName === 'indexAction') {
                    $path = '';
                } else {
                    $path = self::translatePath($actionName); // '/' . preg_replace_callback('/[A-Z]/', function($matches) {
                }
            }

            $route = array($path, $actionName);

            if (isset($annotations['Method'])) {
                $route[] = array('method' => Mux::convertRequestMethodConstant($annotations['Method']));
            } else {
                $route[] = array();
            }
            $routes[] = $route;
        }

        return $routes;
    }
1162837
public function loadController($controller)
    {
        if (!isset($this->_loadedControllers[$controller])) {
            $controllers = static::controllers();
            if (isset($controllers[$controller])) {
                $className = $controllers[$controller];
                $tagName = $controller;
            } else {
                $className = $this->getNamespace() . '\\controllers\\' . NamesHelper::urlToClass($controller) . 'Controller';
            }
            if (class_exists($className)) {
                $instance = new $className([], $this);
                $instance->setTagName($controller);
                $this->_loadedControllers[$controller] = $instance;
            }
        }
        return $this->_loadedControllers[$controller];
    }
381681
protected function prepareCallController($controller, $newRequest)
    {
        $controller = parent::prepareCallController($controller, $newRequest);
        $controller->setView($this->getView());

        return $controller;
    }
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);
		}
	}
435227
public function setController(AController $controller) {
        if (count(self::$_modules) > 0) {
            foreach (self::$_modules as $module) {
                $module->setController($controller);
            }
        }
    }
1124240
public function resolveController($controller)
    {
        $callable = false;

        if (false !== strpos($controller, '::')) {
            list($controller_class, $method) = explode('::', $controller, 2);

            if (class_exists($controller_class)) {

                // Create controller class, and make sure method is callable
                $callable = array(new $controller_class(), $method);
                $callable = (is_callable($callable)) ? $callable : false;
            }
        }

        return($callable);
    }
1016297
public function setPath(string $path): RouteInterface
   {
       if (!preg_match("/^([\w-\.\/{}=&\?\[\]])+$/", $path)) {
           throw new InvalidArgumentException(
               "Can't set path: invalid UriInterface path " . $path);
       }

       $this->path = ltrim($path, "/");
       return $this; 
    }
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();

		}

	}
297357
public function & SetControllerName ($controllerName) {
		/** @var $this \MvcCore\Request */
		$this->controllerName = $controllerName;
		$routerClass = self::$routerClass;
		$router = & $routerClass::GetInstance();
		$this->params[$router::URL_PARAM_CONTROLLER] = $controllerName;
		
		return $this;
	}
841266
public function resource(string $name, string $controller) : ResourceController
    {
        return $this->resourceController->resourceController($this, $name, $controller);
    }
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;
    }
101238
public function setController($name, $controller=null)
	{
	    if ($name instanceof Controller) {
	        $controller = $name;
	        $sname = $controller->getName();
	    } elseif ($controller instanceof Controller) {
	        $sname = $name && !is_numeric($name) ? $name : $controller->getName();
	    } else {
	        if ($controller) {
	            $class_name = Ioc::findClass($controller, 'controller');
	        } else {
	            $class_name = Ioc::findClass($name, 'controller');
	        }
	        
	        if ($class_name && is_subclass_of($class_name, "\\Wslim\\Console\\Controller")) {
	            $sname = is_numeric($name) ? null : $name;
	            $controller =  new $class_name($sname);
	            if (!$sname) {
	                $sname = $controller->getName();
	            }
	        } else {
	            throw new \LogicException(sprintf('Controller class "%s" is not exists.', $controller));
	        }
	    }
	    
	    if (!$controller->isEnabled()) {
	        return;
	    }
	    
	    if (null === $controller->getDefinition()) {
	        throw new \LogicException(sprintf('Controller class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($controller)));
	    }
	    
	    $this->controllers[$sname] = $controller;
	    
	    foreach ($controller->getAliases() as $alias) {
	        $this->controllers[$alias] = $controller;
	    }
	    
	    return $controller;
	}
422840
public function setState(int $state): ControllerInterface
    {
        switch ($state) {
            case self::STATE_PLAYING:
                return $this->play();
            case self::STATE_PAUSED:
                return $this->pause();
            case self::STATE_STOPPED:
                return $this->pause();
        }
        throw new \InvalidArgumentException("Unknown state: {$state})");
    }