| 1 |
<?php |
| 2 |
|
| 3 |
namespace Aws\S3\S3Transfer\Models; |
| 4 |
|
| 5 |
use Aws\S3\S3Transfer\Utils\FileDownloadHandler; |
| 6 |
|
| 7 |
final class DownloadFileRequest |
| 8 |
{ |
| 9 |
|
| 10 |
private string $destination; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
private bool $failsWhenDestinationExists; |
| 19 |
|
| 20 |
|
| 21 |
private DownloadRequest $downloadRequest; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public function __construct( |
| 29 |
string $destination, |
| 30 |
bool $failsWhenDestinationExists, |
| 31 |
DownloadRequest $downloadRequest |
| 32 |
) { |
| 33 |
$this->destination = $destination; |
| 34 |
$this->failsWhenDestinationExists = $failsWhenDestinationExists; |
| 35 |
$this->downloadRequest = DownloadRequest::fromDownloadRequestAndDownloadHandler( |
| 36 |
$downloadRequest, |
| 37 |
new FileDownloadHandler( |
| 38 |
$destination, |
| 39 |
$failsWhenDestinationExists, |
| 40 |
$downloadRequest->getConfig()['resume_enabled'] ?? false |
| 41 |
) |
| 42 |
); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public function getDestination(): string |
| 49 |
{ |
| 50 |
return $this->destination; |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public function isFailsWhenDestinationExists(): bool |
| 57 |
{ |
| 58 |
return $this->failsWhenDestinationExists; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
public function getDownloadRequest(): DownloadRequest |
| 65 |
{ |
| 66 |
return $this->downloadRequest; |
| 67 |
} |
| 68 |
} |