Get the controller middleware for the route.

@return array
497070
protected function controllerMiddleware()
	{
		list( $class, $method ) = explode( '@', $this->action['uses'] );

		$controller = UniversalBuilder::resolve( $class );

		return ( new ControllerDispatcher( $this->router ) )->getMiddleware( $controller, $method );
	}
657353
public function getRoute() {
		return $this->route ? $this->route : ($this->request ? $this->request->getRoute() : null);
// 		return $this->request->getRoute();
	}
665530
public function DispatchRequest () {
		/** @var \MvcCore\IRoute */
		$route = & $this->router->GetCurrentRoute();
		if ($route === NULL) return $this->DispatchException('No route for request', 404);
		list ($ctrlPc, $actionPc) = [$route->GetController(), $route->GetAction()];
		$actionName = $actionPc . 'Action';
		$viewClass = $this->viewClass;
		$viewScriptFullPath = $viewClass::GetViewScriptFullPath(
			$viewClass::GetScriptsDir(),
			$this->request->GetControllerName() . '/' . $this->request->GetActionName()
		);
		if ($ctrlPc == 'Controller') {
			$controllerName = $this->controllerClass;
		} else if ($this->controller !== NULL) {
			$controllerName = '\\'.get_class($this->controller);
		} else {
			// `App_Controllers_<$ctrlPc>`
			$controllerName = $this->CompleteControllerName($ctrlPc);
			if (!class_exists($controllerName)) {
				// if controller doesn't exists - check if at least view exists
				if (file_exists($viewScriptFullPath)) {
					// if view exists - change controller name to core controller, if not let it go to exception
					$controllerName = $this->controllerClass;
				} else {
					return $this->DispatchException("Controller class `$controllerName` doesn't exist.", 404);
				}
			}
		}
		return $this->DispatchControllerAction(
			$controllerName,
			$actionName,
			$viewScriptFullPath,
			function (\Exception & $e) {
				return $this->DispatchException($e);
			}
		);
	}
1370662
public function getController()
    {
        list($controller) = explode('@', $this->getAction());

        if (! $this->controller) {
            $this->setController($this->makeController($controller));
        }

        return $this->controller;
    }
903620
public function getContext(): ?array
    {
        if ($this->currentRequest === null) {
            return null;
        }

        $controller = null;

        if ($route = $this->currentRequest->route()) {
            $controller = $route->controller;

            if (! $controller && ! is_string($route->action['uses'])) {
                $controller = $route->action['uses'];
            }
        }

        return [
            'uri' => $this->currentRequest->getUri(),
            'method' => $this->currentRequest->getMethod(),
            'controller' => $controller ? $this->cloner->cloneVar(class_basename($controller)) : $controller,
            'identifier' => spl_object_hash($this->currentRequest),
        ];
    }
439206
protected function getApiKeyMiddleware()
    {
        $handleRequest = function (RequestInterface $request) {
            return $request->withUri(Uri::withQueryValue(
                $request->getUri(),
                static::PARAM_API_KEY,
                $this->apiKey
            ));
        };

        return Middleware::mapRequest($handleRequest);
    }
176401
public function routeScans()
    {
        if ($this->scanEverything) {
            return $this->getAllClasses();
        }

        $classes = $this->scanRoutes;

        // scan the controllers namespace if the flag is set
        if ($this->scanControllers) {
            $classes = array_merge(
              $classes,
              $this->getClassesFromNamespace($this->getAppNamespace().'Http\\Controllers')
            );
        }

        return $classes;
    }
291414
public static function getMiddleware($controller, $method)
    {
        if (! method_exists($controller, 'getMiddleware')) {
            return array();
        }

        $results = array();

        foreach ($controller->getMiddleware() as $middleware => $options) {
            if (static::methodExcludedByOptions($method, $options)) {
                continue;
            }

            $results[] = $middleware;
        }

        return $results;
    }
661930
public static function routes()
    {
        $middleware = [ CreateDefaultFolder::class, MultiUser::class ];
        $as = 'unisharp.lfm.';
        $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\';

        Route::group(compact('middleware', 'as', 'namespace'), function () {

            // display main layout
            Route::get('/', [
                'uses' => 'LfmController@show',
                'as' => 'show',
            ]);

            // display integration error messages
            Route::get('/errors', [
                'uses' => 'LfmController@getErrors',
                'as' => 'getErrors',
            ]);

            // upload
            Route::any('/upload', [
                'uses' => 'UploadController@upload',
                'as' => 'upload',
            ]);

            // list images & files
            Route::get('/jsonitems', [
                'uses' => 'ItemsController@getItems',
                'as' => 'getItems',
            ]);

            Route::get('/move', [
                'uses' => 'ItemsController@move',
                'as' => 'move',
            ]);

            Route::get('/domove', [
                'uses' => 'ItemsController@domove',
                'as' => 'domove'
            ]);

            // folders
            Route::get('/newfolder', [
                'uses' => 'FolderController@getAddfolder',
                'as' => 'getAddfolder',
            ]);

            // list folders
            Route::get('/folders', [
                'uses' => 'FolderController@getFolders',
                'as' => 'getFolders',
            ]);

            // crop
            Route::get('/crop', [
                'uses' => 'CropController@getCrop',
                'as' => 'getCrop',
            ]);
            Route::get('/cropimage', [
                'uses' => 'CropController@getCropimage',
                'as' => 'getCropimage',
            ]);
            Route::get('/cropnewimage', [
                'uses' => 'CropController@getNewCropimage',
                'as' => 'getCropimage',
            ]);

            // rename
            Route::get('/rename', [
                'uses' => 'RenameController@getRename',
                'as' => 'getRename',
            ]);

            // scale/resize
            Route::get('/resize', [
                'uses' => 'ResizeController@getResize',
                'as' => 'getResize',
            ]);
            Route::get('/doresize', [
                'uses' => 'ResizeController@performResize',
                'as' => 'performResize',
            ]);

            // download
            Route::get('/download', [
                'uses' => 'DownloadController@getDownload',
                'as' => 'getDownload',
            ]);

            // delete
            Route::get('/delete', [
                'uses' => 'DeleteController@getDelete',
                'as' => 'getDelete',
            ]);

            Route::get('/demo', 'DemoController@index');
        });
    }
1314465
protected function getOptions()
    {
        return array(
           array('path', null, InputOption::VALUE_OPTIONAL, 'Path to controllers directory.', app_path() . '/controllers'),
           array('template', null, InputOption::VALUE_OPTIONAL, 'Path to template.', $this->getTemplatePath('controller.txt')),
        );
    }
241107
public static function get()
    {
        $middleware = config('media-manager.routes.middleware');
        if (!empty($middleware)) {
            Route::group(['middleware' => $middleware], function () {
                self::loadRoutes();
            });

            return;
        }

        self::loadRoutes();
    }
556629
private function getController()
        {
            $expected = $this->request['resource'];
            foreach(glob(APPLICATION_PATH . '/Controllers/*.php', GLOB_NOSORT) as $controller) {
                $controller = basename($controller, '.php');
                if(strnatcasecmp($expected, $controller) == 0) {
                    return 'Controllers_' . $controller;
                }
            }
            return null;
        }
1184156
public function getControllerAndAction(){
		$path_info = Yii::$app->request->getPathInfo();
		$path_info = trim($path_info,"/");
		$controller_str = substr($path_info,strpos($path_info,"/")+1);
		$str = strrev($controller_str);
		$action = strrev(substr($str,0,strpos($str,"/")));
		$controllerstr = strrev(substr($str,strpos($str,"/")+1));
		$controllerstr = explode("/",$controllerstr);
		$arr = [];
		$count = count($controllerstr);
		$i = 0;
		foreach($controllerstr as $v){
			$i++;
			if($count == $i){
				$arr[] = ucfirst($v);
			}else{
				$arr[] = strtolower($v);
			}
		}
		return [
			'controller' => implode("/",$arr),
			'action'	=>  $action,
		];
	}
808013
public function getController()
    {
        if (! isset($this->controller)) {
            list ($controller, $this->method) = $this->parseControllerCallback();

            return $this->controller = $this->container->make($controller);
        }

        return $this->controller;
    }
1132126
public function routes()
    {
        $routes = $this->app->make('routes.collection')->getAll();

        $headers = ['Condition', 'Filter', 'Action', 'Parameters', 'Pattern', 'Guid'];

        $dataset = array_map(function ($route) {
            return [
                $route->getCondition(),
                $route->getFilter(),
                $route->getAction(),
                $route->getParameters(),
                $route->getPattern(),
                $route->getGuid(),
            ];
        }, $routes);

        $this->table($headers, $dataset);
    }
866373
public function getRoute() {
        if (is_null($this->route)) {
            $this->route = Yii::$app->request->getHostInfo() . '/' . Yii::$app->request->getPathInfo();
        }
        return $this->route;
    }
1361309
public function getController() {
        $module = $this->getModule();
        $namespace = $module->getController($this->getParam('controller'));

        /** @type \Titon\Controller\Controller $controller */
        $controller = new $namespace($this->getParams());
        $controller->setRequest($this->getRequest());
        $controller->setResponse($this->getResponse());

        if ($controller instanceof UseApplication) {
            $controller->setApplication($this->getApplication());
        }

        if ($controller instanceof UseModule) {
            $controller->setModule($module);
        }

        if (method_exists($controller, 'initialize')) {
            $controller->initialize();
        }

        return $controller;
    }