classDownload
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
$client | HttpClientInterface|null | The client; a default client when null |
public function get(string $uri): stringDownloads a document.
Parameters
$uri | string | The HTTP(S) URL |
Returns
string The response bodyThrows
RuntimeException When the status is not 2xx or the body exceeds 16 MiBExceptionInterface When the transfer failsTest cases 8
DownloadTest::testGetAcceptsSuccessfulStatuscallsDownloadTest::testGetAcceptsTheSizeLimitcallsDownloadTest::testGetPropagatesTransportFailurescallsDownloadTest::testGetRejectsBodiesOverTheSizeLimitcallsDownloadTest::testGetRejectsOtherStatuscallsDownloadTest::testGetReturnsTheBodycallsDownloadTest::testGetSendsABoundedRequestcallsDownloadTest::testGetUsesADefaultClientcalls
Called from 1
Private surface 1§
Implementation details, listed for orientation only.
private HttpClientInterface|null $client = nullTest cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
DownloadTest::testGetAcceptsSuccessfulStatuscallsDownloadTest::testGetAcceptsTheSizeLimitcallsDownloadTest::testGetPropagatesTransportFailurescallsDownloadTest::testGetRejectsBodiesOverTheSizeLimitcallsDownloadTest::testGetRejectsOtherStatuscallsDownloadTest::testGetReturnsTheBodycallsDownloadTest::testGetSendsABoundedRequestcallsDownloadTest::testGetUsesADefaultClientcalls
Other tests reaching this symbol 1
ResourceLoaderTestcalls