src/Application.php
public function handle(ServerRequestInterface $request)
    {
        $callback = new CallbackHandler(self::$container);

        if (static::$container->has(self::MIDDLEWARE)) {
            $middleware = static::$container->get(self::MIDDLEWARE);

            $delegate = new Delegate($callback);

            $result = $middleware->process($request, $delegate);
        }

        return isset($result) ? $result : $callback($request);
    }
public function handle(ServerRequestInterface $request)
    {
        $callback = new CallbackHandler(self::$container);

        if (static::$container->has(self::MIDDLEWARE)) {
            $middleware = static::$container->get(self::MIDDLEWARE);

            $delegate = new Delegate($callback);

            $result = $middleware->process($request, $delegate);
        }

        return isset($result) ? $result : $callback($request);
    }
Handles the ServerRequestInterface to convert it to a ResponseInterface.

@param  \Psr\Http\Message\ServerRequestInterface $request
@return \Psr\Http\Message\ResponseInterface