protected function getHttpApplication(ServiceLocatorInterface $serviceLocator): HttpApplication
    {
        $chain = $serviceLocator->getService(MiddlewareChainInterface::class);
        $request = $serviceLocator->getService(RequestInterface::class);

        /**
         * @var MiddlewareChainInterface $chain
         * @var RequestInterface         $request
         */
        return new HttpApplication(
            $chain,
            $request,
            $serviceLocator,
            $extra['modules'] ?? []
        );
    }