private function convertClassStringToFactory($string) : Closure
    {
        $this->controllerName = null;
        $this->controllerMethod = null;

        @list($className, $method) = explode('@', $string);

        if (!isset($className) || !isset($method)) {
            throw new RouteClassStringParseException('Could not parse route controller from string: `' . $string . '`');
        }

        if (!class_exists($className)) {
            throw new RouteClassStringControllerNotFoundException(
                'Could not find route controller class: `' . $className . '`'
            );
        }

        if (!method_exists($className, $method)) {
            throw new RouteClassStringMethodNotFoundException(
                'Route controller class: `' . $className . '` does not have a `' . $method . '` method'
            );
        }

        $this->controllerName = $className;
        $this->controllerMethod = $method;

        return function () {
            $controller = $this->getController();
            $method = $this->controllerMethod;

            if ($this->invoker) {
                return [$controller, $method];
            }

            return function ($params = null) use ($controller, $method) {
                return $controller->$method($params);
            };
        };
    }
private function convertClassStringToFactory($string) : Closure
    {
        $this->controllerName = null;
        $this->controllerMethod = null;

        @list($className, $method) = explode('@', $string);

        if (!isset($className) || !isset($method)) {
            throw new RouteClassStringParseException('Could not parse route controller from string: `' . $string . '`');
        }

        if (!class_exists($className)) {
            throw new RouteClassStringControllerNotFoundException(
                'Could not find route controller class: `' . $className . '`'
            );
        }

        if (!method_exists($className, $method)) {
            throw new RouteClassStringMethodNotFoundException(
                'Route controller class: `' . $className . '` does not have a `' . $method . '` method'
            );
        }

        $this->controllerName = $className;
        $this->controllerMethod = $method;

        return function () {
            $controller = $this->getController();
            $method = $this->controllerMethod;

            if ($this->invoker) {
                return [$controller, $method];
            }

            return function ($params = null) use ($controller, $method) {
                return $controller->$method($params);
            };
        };
    }
private function convertClassStringToFactory ( $ string ) : Closure { $ this -> controllerName = null ; $ this -> controllerMethod = null ; @ list ( $ className , $ method ) = explode ( '@' , $ string ) ; if ( ! isset ( $ className ) || ! isset ( $ method ) ) { throw new RouteClassStringParseException ( 'Could not parse route controller from string: `' . $ string . '`' ) ; } if ( ! class_exists ( $ className ) ) { throw new RouteClassStringControllerNotFoundException ( 'Could not find route controller class: `' . $ className . '`' ) ; } if ( ! method_exists ( $ className , $ method ) ) { throw new RouteClassStringMethodNotFoundException ( 'Route controller class: `' . $ className . '` does not have a `' . $ method . '` method' ) ; } $ this -> controllerName = $ className ; $ this -> controllerMethod = $ method ; return function ( ) { $ controller = $ this -> getController ( ) ; $ method = $ this -> controllerMethod ; if ( $ this -> invoker ) { return [ $ controller , $ method ] ; } return function ( $ params = null ) use ( $ controller , $ method ) { return $ controller -> $ method ( $ params ) ; } ; } ; }
Create a factory Closure for the given Controller string

@param  string $string e.g. `MyController@myMethod`
@return Closure
Create a factory Closure for the given Controller string