src/RequestFactory/GenericRequestFactory.php
public function create(ServerRequestInterface $serverRequest): APIRequest
    {
        $parsedURL = $this->URLParser->parse($serverRequest->getUri());

        //TODO: Evaluate if this is still needed, as serverRequest allows getting of specific headers
        $parsedHeaders = $this->headerParser->parse($serverRequest->getHeaders());

        $urlQueryData = [];
        if($urlQueryString = $parsedURL->getQueryString()) {
            parse_str($urlQueryString, $urlQueryData);
        }

        $apiKey = $parsedURL->getAPIKey();
        if($apiKey === null) {
            $apiKey = $parsedHeaders->getAPIKey();
        }

        $acceptableMIMETypes = array_unique(array_merge(
            $parsedURL->getAcceptableMIMETypes(),
            $parsedHeaders->getAcceptableMIMETypes()
        ));

        return new APIRequest($serverRequest->getMethod(), $parsedURL->getEndpoint(), $parsedURL->getElement(),
            $acceptableMIMETypes, $parsedURL->getVersion(), $apiKey, $urlQueryData, $serverRequest->getParsedBody());
    }
public function create(ServerRequestInterface $serverRequest): APIRequest
    {
        $parsedURL = $this->URLParser->parse($serverRequest->getUri());

        //TODO: Evaluate if this is still needed, as serverRequest allows getting of specific headers
        $parsedHeaders = $this->headerParser->parse($serverRequest->getHeaders());

        $urlQueryData = [];
        if($urlQueryString = $parsedURL->getQueryString()) {
            parse_str($urlQueryString, $urlQueryData);
        }

        $apiKey = $parsedURL->getAPIKey();
        if($apiKey === null) {
            $apiKey = $parsedHeaders->getAPIKey();
        }

        $acceptableMIMETypes = array_unique(array_merge(
            $parsedURL->getAcceptableMIMETypes(),
            $parsedHeaders->getAcceptableMIMETypes()
        ));

        return new APIRequest($serverRequest->getMethod(), $parsedURL->getEndpoint(), $parsedURL->getElement(),
            $acceptableMIMETypes, $parsedURL->getVersion(), $apiKey, $urlQueryData, $serverRequest->getParsedBody());
    }
Creates a request from raw $data and a $url
@param ServerRequestInterface $serverRequest
@return APIRequest
@throws UnableToCreateRequestException
@throws UnableToParseHeadersException
@throws UnableToParseURLException