Get method from controller name.

@param $controllername
@return string
978439
protected function controllerMethod($controllername)
    {
        if (str_contains($controller = $controllername, '@')) {
            return substr($controllername, strpos($controllername, '@')+1, strlen($controllername));
        }
        return 'index';
    }
854092
public static function getActions($controllerClassName) {
        try {
            $actions = ServiceManager::getServiceManager()->get('generis/cache')->get(self::CONTROLLER_PREFIX.$controllerClassName);
        } catch (\common_cache_NotFoundException $e) {
            $factory = new Factory();
            $desc =  $factory->getControllerDescription($controllerClassName);
            
            $actions = array();
            foreach ($desc->getActions() as $action) {
                $actions[] = $action->getName();
            }
            ServiceManager::getServiceManager()->get('generis/cache')->put($actions, self::CONTROLLER_PREFIX.$controllerClassName);
        }
        return $actions;
    }
673712
public function reverseRoute( $controllerName, $actionName )
    {
        // Create a temp route because formatting
        $tempRoute = new Route( ["controllerName" => $controllerName, "actionName" => $actionName] );

        foreach ( $this->_routeDefinitions as $routeDefinition )
        {
            $route = call_user_func($routeDefinition);

            if ( $tempRoute->getControllerName() == $route->getControllerName() && $tempRoute->getActionName() == $route->getActionName() )
            {
                return $route->getUri();
            }
        }
    }
469663
private function callControllerMethod(Controller $controller, $method)
    {
        return app()->call([$controller, $method], ParameterBag::getParameters());
    }
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;
    }
16237
protected function getMethod($name) 
    {
        if (isset(self::$_methods[$name])) {
            return $name;
        }

        if (isset(self::$_methods['array_'.$name])) {
            return 'array_'.$name;
        }

        $uncamel = strtolower(preg_replace("/([A-Z])/", "_$1", $name));

        if (isset(self::$_methods[$uncamel])) {
            return $uncamel;
        }

        if (isset(self::$_methods['array_'.$uncamel])) {
            return 'array_'.$uncamel;
        }

        return $name;
    }
1238641
public function getMethod($name)
    {
        $methods = $this->getMethods();
        foreach ($methods as $method) {
            if ($method->getName() == $name) {
                return $method;
            }
        }

        return false;
    }
800489
protected function getControllerMiddleware($actionName)
    {
        $segments = explode('@', $actionName);

        return $this->getControllerMiddlewareFromInstance(
            $this->app->make($segments[0]), $segments[1]
        );
    }
931049
protected function controllerWithoutMethod($controllername)
    {
        if (str_contains($controller = $controllername, '@')) {
            return ucfirst(substr($controllername, 0, strpos($controllername, '@')));
        }
        return ucfirst($controllername);
    }
1317229
function getMethod($methodName)
    {
        if (!$this->hasMethod($methodName))
            throw new \Exception(sprintf(
                'Method (%s) not found.'
                , $methodName
            ));

        if (isset($this->_t__methods[$methodName])) {
            ## from bind closure
            $methodCallable = $this->_t__methods[$methodName];
        } else {
            $bindTo = $this->getBindTo();
            $methodCallable = function() use($methodName, $bindTo) {
                return call_user_func_array([$bindTo, $methodName], func_get_args());
            };
        }

        ## bind it into latest bind object
        $methodCallable = \Closure::bind(
            $methodCallable
            , $this->getBindTo()
            , get_class($this->getBindTo())
        );

        return $methodCallable;
    }
110105
public function getControllerActionName()
    {
        $controllerObjectName = $this->getControllerObjectName();
        if ($controllerObjectName !== '' && ($this->controllerActionName === strtolower($this->controllerActionName))) {
            $controllerClassName = $this->objectManager->getClassNameByObjectName($controllerObjectName);
            $lowercaseActionMethodName = strtolower($this->controllerActionName) . 'action';
            foreach (get_class_methods($controllerClassName) as $existingMethodName) {
                if (strtolower($existingMethodName) === $lowercaseActionMethodName) {
                    $this->controllerActionName = substr($existingMethodName, 0, -6);
                    break;
                }
            }
        }
        return $this->controllerActionName;
    }
766155
public function getProperty(string $methodName): ?string
    {
        $pattern = implode('|', array_merge(self::ACCESSOR_PREFIXES, self::MUTATOR_PREFIXES));

        if (preg_match('/^('.$pattern.')(.+)$/i', $methodName, $matches)) {
            return $matches[2];
        }

        return null;
    }
343823
public function handleController($controller, $method)
    {
        if($this->app->findController($controller)) {
            $controllerClass = "App\\Controller\\".$controller;
            $this->controller = new $controllerClass();
        }
        if($this->app->hasMethod($this->controller, $method)) {
            self::$instance = $this;
            ob_start();
            $return = $this->controller->$method();
            $output = ob_get_clean();
            self::$instance = null;
        }
        if($return !== null) {
            //handle returned value
        }
        $output = $output ?: null;
        return $output;
    }
644295
public function controllerWithoutPrefix($controller)
    {
        $controller = new ReflectionClass($controller);
        $methods = $controller->getMethods(ReflectionMethod::IS_PUBLIC);
        return $this->collectControllerRoutes($controller, $methods, "/");
    }
1318404
public static function getControllerAccess($controllerClassName)
    {
        try{
            $returnValue = self::getCacheImplementation()->get(self::SERIAL_PREFIX_MODULE.$controllerClassName);
        } catch (\common_cache_Exception $e) {
            
            $extId = MapHelper::getExtensionFromController($controllerClassName);
            $extension = MapHelper::getUriForExtension($extId);
            $module = MapHelper::getUriForController($controllerClassName);
            
            $roleClass = new \core_kernel_classes_Class(GenerisRdf::CLASS_ROLE);
            $accessProperty = new \core_kernel_classes_Property(AccessService::PROPERTY_ACL_GRANTACCESS);

            $returnValue = array('module' => array(), 'actions' => array());
            
            // roles by extensions
            $roles = $roleClass->searchInstances(array(
                    $accessProperty->getUri() => $extension
                ), array(
                    'recursive' => true, 'like' => false
            ));
            foreach ($roles as $grantedRole) {
                $returnValue['module'][] = $grantedRole->getUri();
            }
            
            // roles by controller
            $filters = array(
                $accessProperty->getUri() => $module
            );
            $options = array('recursive' => true, 'like' => false);
            
            foreach ($roleClass->searchInstances($filters, $options) as $grantedRole){
                $returnValue['module'][] = $grantedRole->getUri();
            }
            
            // roles by action
            foreach (ControllerHelper::getActions($controllerClassName) as $actionName) {
                $actionUri = MapHelper::getUriForAction($controllerClassName, $actionName);
                $rolesForAction = $roleClass->searchInstances(array(
                    $accessProperty->getUri() => $actionUri
                ), array('recursive' => true, 'like' => false));
                if (!empty($rolesForAction)) {
                    $actionName = MapHelper::getActionFromUri($actionUri);
                    $returnValue['actions'][$actionName] = array();
                    foreach ($rolesForAction as $roleResource) {
                        $returnValue['actions'][$actionName][] = $roleResource->getUri();
                    }
                }
            }
            
            self::getCacheImplementation()->put($returnValue, self::SERIAL_PREFIX_MODULE.$controllerClassName);
        }
        return $returnValue;
    }
741929
public function findController(string $name)
    {
        foreach ($this->controllers as $controller) {
            if ($controller->getName() === $name) {
                return $controller;
            }
        }

        return null;
    }
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;
        }