PPI\Framework\Module\Controller\ControllerNameParser::parse PHP 메소드

parse() 공개 메소드

Converts a short notation a:b:c to a class::method.
public parse ( string $controller ) : string
$controller string A short notation controller (a:b:c)
리턴 string A string with class::method
    public function parse($controller)
    {
        list($module, $moduleName, $controller, $action) = $this->getPartsFromControllerName($controller);
        if (null === $module) {
            // this throws an exception if there is no such module
            $msg = sprintf('Unable to find controller "%s:%s" - module alias "%s" does not exist.', $moduleName, $controller, $moduleAlias);
        } else {
            $class = $module->getNamespace() . '\\Controller\\' . $controller;
            if (class_exists($class)) {
                return $class . '::' . $action . 'Action';
            }
            $msg = sprintf('Unable to find controller "%s:%s" - class "%s" does not exist.', $moduleName, $controller, $class);
        }
        throw new \InvalidArgumentException($msg);
    }