final class Download

Downloads a source document over HTTP(S) within the 16 MiB limit.

Requests time out after 20 seconds and follow at most five redirects; only 2xx responses are accepted.

Methods§

public function __construct(private HttpClientInterface|null $client = null)

Parameters

$clientHttpClientInterface|nullThe client; a default client when null
public function get(string $uri): string

Downloads a document.

Parameters

$uristringThe HTTP(S) URL

Returns

string The response body

Throws

RuntimeException When the status is not 2xx or the body exceeds 16 MiB
ExceptionInterface When the transfer fails
Test cases 8
Called from 1
Calls 3

Private surface 1§

Implementation details, listed for orientation only.

private HttpClientInterface|null $client = null

Test cases 9§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 8
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Method calls 1