src/Retriever.php
public function retrieve(RequestInterface $request): WebResourceInterface
    {
        if (!$this->allowUnknownResourceTypes) {
            $headRequest = $request->withMethod('HEAD');

            $this->preVerifyContentType($headRequest);
        }

        $requestUri = $request->getUri();
        $response = null;

        try {
            $response = $this->httpClient->send($request, [
                'on_stats' => function (TransferStats $stats) use (&$requestUri) {
                    if ($stats->hasResponse()) {
                        $requestUri = $stats->getEffectiveUri();
                    }
                },
            ]);
        } catch (BadResponseException $badResponseException) {
            $response = $badResponseException->getResponse();
        } catch (RequestException $requestException) {
            throw new TransportException($request, $requestException);
        } catch (GuzzleException $guzzleException) {
            throw new TransportException(
                $request,
                new RequestException($guzzleException->getMessage(), $request, null, $guzzleException)
            );
        }

        $responseStatusCode = $response->getStatusCode();
        $isSuccessResponse = $responseStatusCode >= 200 && $responseStatusCode < 300;

        if (!$isSuccessResponse) {
            throw new HttpException($request, $response);
        }

        $modelClassName = $this->getModelClassNameFromContentTypeWithContentTypeVerification($request, $response);

        return new $modelClassName(WebResourceProperties::create([
            WebResourceProperties::ARG_URI => $requestUri,
            WebResourceProperties::ARG_RESPONSE => $response,
        ]));
    }
public function retrieve(RequestInterface $request): WebResourceInterface
    {
        if (!$this->allowUnknownResourceTypes) {
            $headRequest = $request->withMethod('HEAD');

            $this->preVerifyContentType($headRequest);
        }

        $requestUri = $request->getUri();
        $response = null;

        try {
            $response = $this->httpClient->send($request, [
                'on_stats' => function (TransferStats $stats) use (&$requestUri) {
                    if ($stats->hasResponse()) {
                        $requestUri = $stats->getEffectiveUri();
                    }
                },
            ]);
        } catch (BadResponseException $badResponseException) {
            $response = $badResponseException->getResponse();
        } catch (RequestException $requestException) {
            throw new TransportException($request, $requestException);
        } catch (GuzzleException $guzzleException) {
            throw new TransportException(
                $request,
                new RequestException($guzzleException->getMessage(), $request, null, $guzzleException)
            );
        }

        $responseStatusCode = $response->getStatusCode();
        $isSuccessResponse = $responseStatusCode >= 200 && $responseStatusCode < 300;

        if (!$isSuccessResponse) {
            throw new HttpException($request, $response);
        }

        $modelClassName = $this->getModelClassNameFromContentTypeWithContentTypeVerification($request, $response);

        return new $modelClassName(WebResourceProperties::create([
            WebResourceProperties::ARG_URI => $requestUri,
            WebResourceProperties::ARG_RESPONSE => $response,
        ]));
    }
@param RequestInterface $request

@return WebResourceInterface

A RetrieverExceptionInterface instance MUST be thrown when a resource
is retrieved with a status code other than 200.

An InvalidContentTypeExceptionInterface instance MUST  be thrown when the content type of a resource
does not match one of those provided by setAllowedContentTypes() and when unknown resource types are not allowed.

@throws HttpException
@throws InternetMediaTypeParseException
@throws TransportException
@throws InvalidResponseContentTypeException