src/Middleware/Middleware/DispatchMiddleware.php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $actionName = $request->getAttribute('actionName');

        // TODO: use a specific container and enforce type checking
        $action = $this->container->get($actionName);

        if (($action instanceof RequestHandlerInterface) === false) {
            throw UnexpectedActionTypeException::invalidType($action);
        }

        return $action->handle($request);
    }
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $actionName = $request->getAttribute('actionName');

        // TODO: use a specific container and enforce type checking
        $action = $this->container->get($actionName);

        if (($action instanceof RequestHandlerInterface) === false) {
            throw UnexpectedActionTypeException::invalidType($action);
        }

        return $action->handle($request);
    }
Process an incoming server request and return a response, optionally delegating
to the next middleware component to create the response.

@param ServerRequestInterface $request
@param RequestHandlerInterface $handler

@throws \Psr\Container\ContainerExceptionInterface
@throws \Psr\Container\NotFoundExceptionInterface

@return ResponseInterface