src/Leevel/Http/Leevel2Psr.php
public function createRequest(IRequest $leevelRequest): ServerRequestInterface
    {
        $server = normalizeServer($leevelRequest->server->all());
        $headers = $leevelRequest->headers->all();

        $body = new DiactorosStream($this->normalizeContent($leevelRequest->getContent()));

        $request = new ServerRequest(
            $server,
            normalizeUploadedFiles($this->getFiles($leevelRequest->files->all())),
            $leevelRequest->getSchemeAndHttpHost().$leevelRequest->getRequestUri(),
            $leevelRequest->getMethod(),
            $body,
            $headers
        );

        $request = $request
            ->withCookieParams($leevelRequest->cookies->all())
            ->withQueryParams($leevelRequest->query->all())
            ->withParsedBody($leevelRequest->request->all())
            ->withRequestTarget($leevelRequest->getRequestUri());

        foreach ($leevelRequest->params->all() as $key => $value) {
            $request = $request->withAttribute($key, $value);
        }

        return $request;
    }
public function createRequest(IRequest $leevelRequest): ServerRequestInterface
    {
        $server = normalizeServer($leevelRequest->server->all());
        $headers = $leevelRequest->headers->all();

        $body = new DiactorosStream($this->normalizeContent($leevelRequest->getContent()));

        $request = new ServerRequest(
            $server,
            normalizeUploadedFiles($this->getFiles($leevelRequest->files->all())),
            $leevelRequest->getSchemeAndHttpHost().$leevelRequest->getRequestUri(),
            $leevelRequest->getMethod(),
            $body,
            $headers
        );

        $request = $request
            ->withCookieParams($leevelRequest->cookies->all())
            ->withQueryParams($leevelRequest->query->all())
            ->withParsedBody($leevelRequest->request->all())
            ->withRequestTarget($leevelRequest->getRequestUri());

        foreach ($leevelRequest->params->all() as $key => $value) {
            $request = $request->withAttribute($key, $value);
        }

        return $request;
    }
从 Leevel 请求对象创建 Psr 请求对象

@param \Leevel\Http\IRequest $leevelRequest

@return \Psr\Http\Message\ServerRequestInterface