Get variants to search in config for controller
@param string $controller
@param string|null $module
@return string
492279
private function getRawAndModuleControllers($controller, $module) {
        if ('/' == $module || '' == $module) {
            $rController = $controller;
            $allController = '*';
        } elseif (null === $module) {
            $rController = \mpf\WebApp::get()->request()->getModule() . '/' . $controller;
            $allController = \mpf\WebApp::get()->request()->getModule() . '/*';
        } else {
            $rController = $module . '/' . $controller;
            $allController = $module . '/*';
        }
        return array($rController, $allController);
    }
1081082
protected function getFullyQualifiedClass(string $module_name, string $controller_class) : string
    {
        return 'Application\\Module\\' . $this->getModuleName($module_name) . '\\Controller\\' . $this->getControllerName($controller_class);
    }
980186
protected function getControllerMiddlewareFromInstance($controller, $method)
    {
        $middlewares = $this->router->getMiddleware();

        //
        $results = array();

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

            list($name, $parameters) = array_pad(explode(':', $middleware, 2), 2, null);

            $middleware = Arr::get($middlewares, $name, $name);

            $results[] = (! $middleware instanceof Closure) ? $middleware : $name;
        }

        return $results;
    }
534197
public function getControllerDefaultRoutes($controller, $file)
    {
        $array = array();
        if (isset($this->config['app']['routes'])) {
            $routes = $this->config['app']['routes'];
            if (!is_int(key($routes))) {
                $routes = array($routes);
            }
            foreach ($routes as $item) {
                if (isset($item[$controller])) {
                    $array[] = $item[$controller];
                }
            }
        }

        if(isset($this->config['app']['index'])) {
            $index = $this->config['app']['index'];
            if (strpos($file, $index) !== false) {
                $array[] = $this->cleanUrl(substr($file, 0, strpos($file, $index)));
            }
        }
        $array[] = $this->cleanUrl($file);

        return $array;
    }
758345
protected function getControllerTargetModel($controller)
    {
        switch ($controller) {
            case 'respondent':
                $model = $this->loader->getModels()->getRespondentModel(true);
                $model->applyEditSettings();
                return $model;

            case 'calendar':
                $model = $this->loader->getModels()->createAppointmentModel();
                $this->applySource($model);
                $model->applyEditSettings();
                return $model;

            default:
                return null;
        }
    }
852676
protected function getModuleCommands($module)
    {
        $prefix = $module instanceof Application ? '' : $module->getUniqueId() . '/';

        $commands = [];
        foreach (array_keys($module->controllerMap) as $id) {
            $commands[] = $prefix . $id;
        }

        foreach ($module->getModules() as $id => $child) {
            if (($child = $module->getModule($id)) === null) {
                continue;
            }
            foreach ($this->getModuleCommands($child) as $command) {
                $commands[] = $command;
            }
        }

        $controllerPath = $module->getControllerPath();
        if (is_dir($controllerPath)) {
            $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($controllerPath, \RecursiveDirectoryIterator::KEY_AS_PATHNAME));
            $iterator = new \RegexIterator($iterator, '/.*Controller\.php$/', \RecursiveRegexIterator::GET_MATCH);
            foreach ($iterator as $matches) {
                $file = $matches[0];
                $relativePath = str_replace($controllerPath, '', $file);
                $class = strtr($relativePath, [
                    '/' => '\\',
                    '.php' => '',
                ]);
                $controllerClass = $module->controllerNamespace . $class;
                if ($this->validateControllerClass($controllerClass)) {
                    $dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), '\\/');

                    $command = InflectorHelper::camel2id(substr(basename($file), 0, -14), '-', true);
                    if (!empty($dir)) {
                        $command = $dir . '/' . $command;
                    }
                    $commands[] = $prefix . $command;
                }
            }
        }

        return $commands;
    }
591563
static public function getModuleCommands($module)
    {
        $prefix = $module instanceof Application ? '' : $module->getUniqueId().'/';

        $controllers = [];
        foreach (array_keys($module->controllerMap) as $id) {
            $controllers[] = $prefix.$id;
        }

        foreach ($module->getModules() as $id => $child) {
            if (($child = $module->getModule($id)) === null) {
                continue;
            }
            foreach (static::getModuleCommands($child) as $command) {
                $controllers[] = $command;
            }
        }

        $controllerPath = $module->getControllerPath();
        if (is_dir($controllerPath)) {
            $files = scandir($controllerPath);
            foreach ($files as $file) {
                if (!empty($file) && substr_compare($file, 'Controller.php', -14, 14) === 0) {
                    $controllerClass = $module->controllerNamespace.'\\'.substr(basename($file), 0, -4);
                    if (static::validateControllerClass($controllerClass)) {
                        $controllers[] = $prefix.Inflector::camel2id(substr(basename($file), 0, -14));
                        //$controllers[] = $controllerClass;
                    }
                }
            }
        }

        return $controllers;
    }
583008
protected function autoFindController($module, &$path)
    {
        $dir = $this->app->getAppPath() . ($module ? $module . '/' : '') . $this->rule->getConfig('url_controller_layer');
        $suffix = $this->app->getSuffix() || $this->rule->getConfig('controller_suffix') ? ucfirst($this->rule->getConfig('url_controller_layer')) : '';

        $item = [];
        $find = false;

        foreach ($path as $val) {
            $item[] = $val;
            $file = $dir . '/' . str_replace('.', '/', $val) . $suffix . '.php';
            $file = pathinfo($file, PATHINFO_DIRNAME) . '/' . Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1) . '.php';
            if (is_file($file)) {
                $find = true;
                break;
            } else {
                $dir .= '/' . Loader::parseName($val);
            }
        }

        if ($find) {
            $controller = implode('.', $item);
            $path = array_slice($path, count($item));
        } else {
            $controller = array_shift($path);
        }

        return $controller;
    }
615450
public function beforeRender(Controller $controller) {
		if (!class_exists('NoSql')) {
			return null;
		}

		$content = NoSql::getLogs();
		$count = 0;
		$time = 0;
		foreach ($content as $logs) {
			$count += $logs['count'];
			$time += $logs['time'];
		}

		if ($this->priority > 0) {
			if ($count === 0) {
				$this->title = __d('debug_kit_ex', '<b>%d</b> NoSql', $count);
			} else {
				$this->title = __d('debug_kit_ex', '<b>%dms / %d</b> NoSql', $time, $count);
			}
		}
		return $content;
	}
1360523
private function getPropertyDefinitionConfig($controller)
    {
        $injectableDefinitions = $this->getPropertyDefinition();

        return $this->setPropertyInjection($injectableDefinitions)
             ->getDefinitions($controller);
    }
1095449
public function put(string $module, string $controller): Link
    {
        return $this->addMap(RequestMethod::PUT, $module, $controller);
    }
1019039
public function widget($module, $controller = 'index', $action = 'index', array $params = [])
    {
        return \Mmi\Mvc\ActionHelper::getInstance()->action((new \Mmi\Http\Request($params))
                ->setModuleName($module)
                ->setControllerName($controller)
                ->setActionName($action));
    }
876829
public function addMap($method, $module, $controller): Link
    {
        return $this->map[strtoupper($method)] = new Link($module, $controller);
    }
637400
protected function vars(String & $controller)
    {
        if( ! empty($this->settings['vars']) )
        {
            $var = '';
            foreach( $this->settings['vars'] as $isKey => $var )
            {
                if( ! is_numeric($isKey) )
                {
                    $value = $var;
                    $var   = $isKey;
                }

                $vars = $this->vartype($var);
                $controller .= HT.$vars->priority.' $'.$vars->var.( ! empty($value) ? " = ".$value : '' ).";".EOL;
            }

            $controller .= EOL;
        }
    }
1125024
public function head($module, $controller): Link
    {
        return $this->addMap(RequestMethod::HEAD, $module, $controller);
    }
595176
public static function getDefaultController($module = null, $exception = false) {
        $module = ($module === null) ? static::getDefaultModule() : $module;

        return static::getConfig('modules', $module, 'defaults', 'controller', $exception);
    }
213990
public function patch(string $module, string $controller): Link
    {
        return $this->addMap(RequestMethod::PATCH, $module, $controller);
    }