private function extractController($path, $controller, $initialSpace = '')
    {
        $class = new ReflectionClass($this->controllersNamespace.'\\'.$controller);

        $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC);

        $routables = array_filter($methods, function ($method) {
            return
                $method->class != 'Illuminate\Routing\Controller' &&
                Str::startsWith($method->name, ['any', 'get', 'post', 'put', 'delete', 'patch']);
        });

        $routes = "\n$initialSpace// $controller\n";

        foreach ($routables as $routable) {
            $routes .= $initialSpace.$this->createRoute($routable, $path, $controller);
        }

        return $routes;
    }
private function extractController($path, $controller, $initialSpace = '')
    {
        $class = new ReflectionClass($this->controllersNamespace.'\\'.$controller);

        $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC);

        $routables = array_filter($methods, function ($method) {
            return
                $method->class != 'Illuminate\Routing\Controller' &&
                Str::startsWith($method->name, ['any', 'get', 'post', 'put', 'delete', 'patch']);
        });

        $routes = "\n$initialSpace// $controller\n";

        foreach ($routables as $routable) {
            $routes .= $initialSpace.$this->createRoute($routable, $path, $controller);
        }

        return $routes;
    }
private function extractController ( $ path , $ controller , $ initialSpace = '' ) { $ class = new ReflectionClass ( $ this -> controllersNamespace . '\\' . $ controller ) ; $ methods = $ class -> getMethods ( ReflectionMethod :: IS_PUBLIC ) ; $ routables = array_filter ( $ methods , function ( $ method ) { return $ method -> class != 'Illuminate\Routing\Controller' && Str :: startsWith ( $ method -> name , [ 'any' , 'get' , 'post' , 'put' , 'delete' , 'patch' ] ) ; } ) ; $ routes = "\n$initialSpace// $controller\n" ; foreach ( $ routables as $ routable ) { $ routes .= $ initialSpace . $ this -> createRoute ( $ routable , $ path , $ controller ) ; } return $ routes ; }
Extract routes from a given controller

@param string $path
@param string $controller

@param string $initialSpace

@return string
Extract routes from a given controller