public static function fromPsrRequest(ServerRequestInterface $request)
    {
        $url = (string) $request->getUri();
        $httpMethod = $request->getMethod();

        // Let's find the parameters relevant to this request
        $parameters = (array) $request->getParsedBody() + $request->getQueryParams();

        // We have a Authorization-header with OAuth data. Parse the header
        // and add those overriding any duplicates from GET or POST
        if (substr($request->getHeaderLine('Authorization'), 0, 6) == 'OAuth ') {
            $header_parameters = Util::splitHeader(
                $request->getHeaderLine('Authorization')
            );
            $parameters = array_merge($parameters, $header_parameters);
        }

        return new Request($httpMethod, $url, $parameters);
    }