@static

@param string $controllerClassBasename

@throws \InvalidArgumentException

@return string
773286
public static function validateControllerClassBasename($controllerClassBasename)
    {
        $controllerClassBasename = str_replace('/', '\\', $controllerClassBasename);

        if (false !== strpos($controllerClassBasename, ':')) {
            throw new \InvalidArgumentException(sprintf(
                'The controller class name must not contain a ":" (colon sign) ("%s" given, '
                .'expecting something like PostAdminController")',
                $controllerClassBasename
            ));
        }

        if ('Controller' !== substr($controllerClassBasename, -10)) {
            throw new \InvalidArgumentException('The controller class name must end with "Controller".');
        }

        return $controllerClassBasename;
    }
1142310
private function getControllerLocator($controller)
    {
        $class = null;
        $prefix = null;

        if (0 === strpos($controller, '@')) {
            $file = $this->locator->locate($controller);
            $controllerClass = ClassUtils::findClassInFile($file);

            if (false === $controllerClass) {
                throw new \InvalidArgumentException(sprintf('Can\'t find class for controller "%s"', $controller));
            }

            $controller = $controllerClass;
        }

        if ($this->container->has($controller)) {
            // service_id
            $prefix = $controller.':';

            if (Kernel::VERSION_ID >= 40100) {
                $prefix .= ':';
            }

            $useScope = method_exists($this->container, 'enterScope') && $this->container->hasScope('request');
            if ($useScope) {
                $this->container->enterScope('request');
                $this->container->set('request', new Request());
            }
            $class = get_class($this->container->get($controller));
            if ($useScope) {
                $this->container->leaveScope('request');
            }
        } elseif (class_exists($controller)) {
            // full class name
            $class = $controller;
            $prefix = $class.'::';
        } elseif (false !== strpos($controller, ':')) {
            // bundle:controller notation
            try {
                $notation = $this->controllerParser->parse($controller.':method');
                list($class) = explode('::', $notation);
                $prefix = $class.'::';
            } catch (\Exception $e) {
                throw new \InvalidArgumentException(
                    sprintf('Can\'t locate "%s" controller.', $controller)
                );
            }
        }

        if (empty($class)) {
            throw new \InvalidArgumentException(sprintf(
                'Class could not be determined for Controller identified by "%s".', $controller
            ));
        }

        return [$prefix, $class];
    }
891221
protected function createController($controller)
    {
        if (false === strpos($controller, '::')) {
            throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller));
        }

        list($class, $method) = explode('::', $controller, 2);

        if (!class_exists($class)) {
            throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
        }

        $controller = new $class();
        if ($controller instanceof ContainerAwareInterface) {
            $controller->setContainer($this->container);
        }

        if ($this->container->has('dashboard.view')) {
            $view = $this->container->get('dashboard.view');
            $loader = $view->getLoader();

            if ($path = $this->getViewsPath($controller, $this->container->getParameter('dashboard.widgets_dir'))) {
                $loader->addPath($path);
                $view->setLoader($loader);
                $this->container->set('view', $view);
            }
        }

        return array($controller, $method);
    }
926787
public function findFirst(string $basename): ?string
    {
        $basename = $this->getClassName($basename);
        foreach ($this->namespaces as $ns) {
            if (class_exists($ns.'\\'.$basename)) {
                return $ns.'\\'.$basename;
            }
        }
        return null;
    }
347631
protected function controller($controllername)
    {
        if (str_contains($controllername, '/')) {
            $controllername = str_replace('/', '\\', $controllername);
        }

        if (str_contains($controllername, '@')) {
            return ucfirst($controllername);
        }
        return ucfirst($controllername . '@index');
    }
612766
public static function getInstanceWithController(
        ContainerInterface $container,
        string $controller,
        string $method,
        array $params = []
    ){
        if(!class_exists($controller)){
            throw new \InvalidArgumentException();
        }

        $controller = $container->has($controller)
            ? $container->get($controller)
            : new $controller($container)
        ;

        if(!($controller instanceof Controller)){
            throw new \InvalidArgumentException();
        }

        if(!is_callable([$controller, $method])){
            throw new \InvalidArgumentException();
        }

        return new static($container, [$controller, $method], $params);
    }
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;
	}
300553
public function getControllerName()
    {
        if (null == $this->controllerName) {
            $this->controllerName = ucfirst($this->input->getArgument('controllerName'));
        }
        return $this->controllerName;
    }
506956
public function getActionDescription($controllerClassName, $actionName) {

        if (!class_exists($controllerClassName) || !method_exists($controllerClassName, $actionName)) {
            throw new ActionNotFoundException('Unknown '.$controllerClassName.'@'.$actionName);
        }

        $reflector = new \ReflectionMethod($controllerClassName, $actionName);
        return new ActionDescription($reflector);
    }
813779
public function getPluginController($pluginName)
    {
        /*
         * Deprecated.  All controllers should come from the controller manager
         * now and not the service manager.
         *
         * @todo Remove if statement once plugins have been converted.
         */
        if ($this->serviceManager->has($pluginName)) {
            $serviceManager = $this->serviceManager;
        } else {
            $serviceManager = $this->serviceManager->get('ControllerLoader');
        }

        if (!$serviceManager->has($pluginName)) {
            throw new InvalidPluginException(
                "Plugin $pluginName is not loaded or configured. Check
            config/application.config.php"
            );
        }

        $pluginController = $serviceManager->get($pluginName);

        //Plugin controllers must implement this interface
        if (!$pluginController instanceof PluginInterface) {
            throw new InvalidPluginException(
                'Class "' . get_class($pluginController) . '" for plugin "'
                . $pluginName . '" does not implement '
                . '\Rcm\Plugin\PluginInterface'
            );
        }

        return $pluginController;
    }
951363
public function getAppControllersMethod($methodName, $scope = '')
    {
        $methods = [];
        
        if ($this->appControllerRefls) {
            foreach ($this->appControllerRefls as $appRefl) {
                if ($appRefl->hasMethod($methodName)) {
                    $method = $appRefl->getMethod($methodName);
                    
                    if ($this->isApplicationController($method->getDeclaringClass()->getName())) {
                        if ($scope) {
                            $isScope = 'is' . ucfirst($scope);
                            if (!$method->$isScope()) {
                                continue;
                            }
                        }
                        $methods[] = $method->getClosure($this);
                    }
                }
            }
        }
        
        return $methods;
    }
915433
public function GetDefaultControllerIfHasAction ($actionName) {
		$defaultControllerName = $this->CompleteControllerName($this->defaultControllerName);
		if (class_exists($defaultControllerName) && method_exists($defaultControllerName, $actionName . 'Action')) {
			return $defaultControllerName;
		}
		return '';
	}
988230
public function controllerName($class = null)
    {
        $name = $class ? $class : get_class($this);
        $name = preg_replace('#^('.preg_quote('Bkwld\Decoy\Controllers\\')
            .'|'.preg_quote('App\Http\Controllers\Admin\\').')#', '', $name);

        return $name;
    }
790901
public function getModel($controllerName) {
		$array = \explode ( "\\", $controllerName );
		$result = \ucfirst ( end ( $array ) );
		if (UString::endswith ( $result, "s" )) {
			$result = \substr ( $result, 0, - 1 );
		}
		return $result;
	}
488676
public function baseName($baseName = null)
    {
        if ($baseName !== null) {
            $this->baseName = rtrim($baseName, '/') . '/';
        }

        return $this->baseName;
    }
56854
public function getControllerName()
    {
        if ($controller = Config::inst()->get(static::class, 'controller_name')) {
            return $controller;
        }

        //default controller for SiteTree objects
        $controller = ContentController::class;

        //go through the ancestry for this class looking for
        $ancestry = ClassInfo::ancestry(static::class);
        // loop over the array going from the deepest descendant (ie: the current class) to SiteTree
        while ($class = array_pop($ancestry)) {
            //we don't need to go any deeper than the SiteTree class
            if ($class == SiteTree::class) {
                break;
            }
            // If we have a class of "{$ClassName}Controller" then we found our controller
            if (class_exists($candidate = sprintf('%sController', $class))) {
                $controller = $candidate;
                break;
            } elseif (class_exists($candidate = sprintf('%s_Controller', $class))) {
                // Support the legacy underscored filename, but raise a deprecation notice
                Deprecation::notice(
                    '5.0',
                    'Underscored controller class names are deprecated. Use "MyController" instead of "My_Controller".',
                    Deprecation::SCOPE_GLOBAL
                );
                $controller = $candidate;
                break;
            }
        }

        return $controller;
    }
888861
private function getControllerPrefix(string $controllerPrefix, string $className): string
    {
        // 注解注入不为空，直接返回prefix
        if (!empty($controllerPrefix)) {
            return $controllerPrefix;
        }

        // 注解注入为空，解析控制器prefix
        $reg    = '/^.*\\\(\w+)' . $this->controllerSuffix . '$/';
        $prefix = '';

        if ($result = \preg_match($reg, $className, $match)) {
            $prefix = '/' . \lcfirst($match[1]);
        }

        return $prefix;
    }