public function handle(
        string $method = null,
        string $path = null,
        $action,
        array $arguments = [],
        ContainerInterface $di = null
    ) {
        $this->di = $di;

        if (is_null($action)) {
            return;
        }

        if (is_callable($action)) {
            if (is_array($action)
                && is_string($action[0])
                && class_exists($action[0])
            ) {
                $action[] = $arguments;
                return $this->handleAsControllerAction($action);
            }
            return $this->handleAsCallable($action, $arguments);
        }

        if (is_string($action) && class_exists($action)) {
            $callable = $this->isControllerAction($method, $path, $action);
            if ($callable) {
                return $this->handleAsControllerAction($callable);
            }
        }

        if ($di
            && is_array($action)
            && isset($action[0])
            && isset($action[1])
            && is_string($action[0])
        ) {
            // Try to load service from app/di injected container
            return $this->handleUsingDi($action, $arguments, $di);
        }
        
        throw new ConfigurationException("Handler for route does not seem to be a callable action.");
    }
public function handle(
        string $method = null,
        string $path = null,
        $action,
        array $arguments = [],
        ContainerInterface $di = null
    ) {
        $this->di = $di;

        if (is_null($action)) {
            return;
        }

        if (is_callable($action)) {
            if (is_array($action)
                && is_string($action[0])
                && class_exists($action[0])
            ) {
                $action[] = $arguments;
                return $this->handleAsControllerAction($action);
            }
            return $this->handleAsCallable($action, $arguments);
        }

        if (is_string($action) && class_exists($action)) {
            $callable = $this->isControllerAction($method, $path, $action);
            if ($callable) {
                return $this->handleAsControllerAction($callable);
            }
        }

        if ($di
            && is_array($action)
            && isset($action[0])
            && isset($action[1])
            && is_string($action[0])
        ) {
            // Try to load service from app/di injected container
            return $this->handleUsingDi($action, $arguments, $di);
        }
        
        throw new ConfigurationException("Handler for route does not seem to be a callable action.");
    }
public function handle ( string $ method = null , string $ path = null , $ action , array $ arguments = [ ] , ContainerInterface $ di = null ) { $ this -> di = $ di ; if ( is_null ( $ action ) ) { return ; } if ( is_callable ( $ action ) ) { if ( is_array ( $ action ) && is_string ( $ action [ 0 ] ) && class_exists ( $ action [ 0 ] ) ) { $ action [ ] = $ arguments ; return $ this -> handleAsControllerAction ( $ action ) ; } return $ this -> handleAsCallable ( $ action , $ arguments ) ; } if ( is_string ( $ action ) && class_exists ( $ action ) ) { $ callable = $ this -> isControllerAction ( $ method , $ path , $ action ) ; if ( $ callable ) { return $ this -> handleAsControllerAction ( $ callable ) ; } } if ( $ di && is_array ( $ action ) && isset ( $ action [ 0 ] ) && isset ( $ action [ 1 ] ) && is_string ( $ action [ 0 ] ) ) { // Try to load service from app/di injected container return $ this -> handleUsingDi ( $ action , $ arguments , $ di ) ; } throw new ConfigurationException ( "Handler for route does not seem to be a callable action." ) ; }
Handle the action for a route and return the results.

@param string                       $method    the request method.
@param string                       $path      that was matched.
@param string|array                 $action    base for the callable.
@param array                        $arguments optional arguments.
@param ContainerInjectableInterface $di        container with services.

@return mixed as the result from the route handler.
Handle the action for a route and return the results .