src/Router.php
public function controller($route, $settings, $controller = null)
    {
        if($this->cacheLoaded) {
            return true;
        }

        if (is_null($controller)) {
            $controller = $settings;
            $settings = [];
        }

        $controller = str_replace(['\\', '.'], '/', $controller);
        $controllerFile = realpath(
            rtrim($this->paths['controllers'], '/') . '/' . $controller . '.php'
        );

        if (! file_exists($controllerFile)) {
            return $this->exception($controller . ' class is not found!');
        }

        if (! class_exists($controller)) {
            require $controllerFile;
        }

        $controller = str_replace('/', '\\', $controller);
        $classMethods = get_class_methods($this->namespaces['controllers'] . $controller);
        if ($classMethods) {
            foreach ($classMethods as $methodName) {
                if(!strstr($methodName, '__')) {
                    $method = "any";
                    foreach(explode('|', RouterRequest::$validMethods) as $m) {
                        if(stripos($methodName, strtolower($m), 0) === 0) {
                            $method = strtolower($m);
                            break;
                        }
                    }

                    $methodVar = lcfirst(str_replace($method, '', $methodName));
                    $r = new ReflectionMethod($this->namespaces['controllers'] . $controller, $methodName);
                    $reqiredParam = $r->getNumberOfRequiredParameters();
                    $totalParam = $r->getNumberOfParameters();

                    $value = ($methodVar === $this->mainMethod ? $route : $route.'/'.$methodVar);
                    $this->{$method}(
                        ($value.str_repeat('/{a}', $reqiredParam).str_repeat('/{a?}', $totalParam-$reqiredParam)),
                        $settings,
                        ($controller . '@' . $methodName)
                    );
                }
            }
            unset($r);
        }

        return true;
    }
public function controller($route, $settings, $controller = null)
    {
        if($this->cacheLoaded) {
            return true;
        }

        if (is_null($controller)) {
            $controller = $settings;
            $settings = [];
        }

        $controller = str_replace(['\\', '.'], '/', $controller);
        $controllerFile = realpath(
            rtrim($this->paths['controllers'], '/') . '/' . $controller . '.php'
        );

        if (! file_exists($controllerFile)) {
            return $this->exception($controller . ' class is not found!');
        }

        if (! class_exists($controller)) {
            require $controllerFile;
        }

        $controller = str_replace('/', '\\', $controller);
        $classMethods = get_class_methods($this->namespaces['controllers'] . $controller);
        if ($classMethods) {
            foreach ($classMethods as $methodName) {
                if(!strstr($methodName, '__')) {
                    $method = "any";
                    foreach(explode('|', RouterRequest::$validMethods) as $m) {
                        if(stripos($methodName, strtolower($m), 0) === 0) {
                            $method = strtolower($m);
                            break;
                        }
                    }

                    $methodVar = lcfirst(str_replace($method, '', $methodName));
                    $r = new ReflectionMethod($this->namespaces['controllers'] . $controller, $methodName);
                    $reqiredParam = $r->getNumberOfRequiredParameters();
                    $totalParam = $r->getNumberOfParameters();

                    $value = ($methodVar === $this->mainMethod ? $route : $route.'/'.$methodVar);
                    $this->{$method}(
                        ($value.str_repeat('/{a}', $reqiredParam).str_repeat('/{a?}', $totalParam-$reqiredParam)),
                        $settings,
                        ($controller . '@' . $methodName)
                    );
                }
            }
            unset($r);
        }

        return true;
    }
public function controller ( $ route , $ settings , $ controller = null ) { if ( $ this -> cacheLoaded ) { return true ; } if ( is_null ( $ controller ) ) { $ controller = $ settings ; $ settings = [ ] ; } $ controller = str_replace ( [ '\\' , '.' ] , '/' , $ controller ) ; $ controllerFile = realpath ( rtrim ( $ this -> paths [ 'controllers' ] , '/' ) . '/' . $ controller . '.php' ) ; if ( ! file_exists ( $ controllerFile ) ) { return $ this -> exception ( $ controller . ' class is not found!' ) ; } if ( ! class_exists ( $ controller ) ) { require $ controllerFile ; } $ controller = str_replace ( '/' , '\\' , $ controller ) ; $ classMethods = get_class_methods ( $ this -> namespaces [ 'controllers' ] . $ controller ) ; if ( $ classMethods ) { foreach ( $ classMethods as $ methodName ) { if ( ! strstr ( $ methodName , '__' ) ) { $ method = "any" ; foreach ( explode ( '|' , RouterRequest :: $ validMethods ) as $ m ) { if ( stripos ( $ methodName , strtolower ( $ m ) , 0 ) === 0 ) { $ method = strtolower ( $ m ) ; break ; } } $ methodVar = lcfirst ( str_replace ( $ method , '' , $ methodName ) ) ; $ r = new ReflectionMethod ( $ this -> namespaces [ 'controllers' ] . $ controller , $ methodName ) ; $ reqiredParam = $ r -> getNumberOfRequiredParameters ( ) ; $ totalParam = $ r -> getNumberOfParameters ( ) ; $ value = ( $ methodVar === $ this -> mainMethod ? $ route : $ route . '/' . $ methodVar ) ; $ this -> { $ method } ( ( $ value . str_repeat ( '/{a}' , $ reqiredParam ) . str_repeat ( '/{a?}' , $ totalParam - $ reqiredParam ) ) , $ settings , ( $ controller . '@' . $ methodName ) ) ; } } unset ( $ r ) ; } return true ; }
Added route from methods of Controller file.

@param string $route
@param string|array $settings
@param null|string $controller

@return mixed
@throws
Added route from methods of Controller file .