public function handle(
        string $path = null,
        ContainerInterface $di = null
    ) {
        if ($this->mount) {
            // Remove the mount path to get base for controller
            $len = strlen($this->mount);
            if (substr($path, 0, $len) == $this->mount) {
                $path = ltrim(substr($path, $len), "/");
            }
        }

        try {
            $handler = new RouteHandler();
            return $handler->handle($this->methodMatched, $path, $this->handler, $this->arguments, $di);
        } catch (ConfigurationException $e) {
            throw new ConfigurationException(
                $e->getMessage()
                . " Route matched method='{$this->methodMatched}', mount='{$this->mount}', path='$path', handler='"
                . (
                    is_string($this->handler)
                        ? "$this->handler"
                        : "array/object"
                )
                . "'."
            );
        }
    }
public function handle(
        string $path = null,
        ContainerInterface $di = null
    ) {
        if ($this->mount) {
            // Remove the mount path to get base for controller
            $len = strlen($this->mount);
            if (substr($path, 0, $len) == $this->mount) {
                $path = ltrim(substr($path, $len), "/");
            }
        }

        try {
            $handler = new RouteHandler();
            return $handler->handle($this->methodMatched, $path, $this->handler, $this->arguments, $di);
        } catch (ConfigurationException $e) {
            throw new ConfigurationException(
                $e->getMessage()
                . " Route matched method='{$this->methodMatched}', mount='{$this->mount}', path='$path', handler='"
                . (
                    is_string($this->handler)
                        ? "$this->handler"
                        : "array/object"
                )
                . "'."
            );
        }
    }
public function handle ( string $ path = null , ContainerInterface $ di = null ) { if ( $ this -> mount ) { // Remove the mount path to get base for controller $ len = strlen ( $ this -> mount ) ; if ( substr ( $ path , 0 , $ len ) == $ this -> mount ) { $ path = ltrim ( substr ( $ path , $ len ) , "/" ) ; } } try { $ handler = new RouteHandler ( ) ; return $ handler -> handle ( $ this -> methodMatched , $ path , $ this -> handler , $ this -> arguments , $ di ) ; } catch ( ConfigurationException $ e ) { throw new ConfigurationException ( $ e -> getMessage ( ) . " Route matched method='{$this->methodMatched}', mount='{$this->mount}', path='$path', handler='" . ( is_string ( $ this -> handler ) ? "$this->handler" : "array/object" ) . "'." ) ; } }
Handle the action for the route.

@param string                       $path the matched path
@param ContainerInjectableInterface $di   container with services

@return mixed
Handle the action for the route .