Debian Codegraph @

lib/3rdParty/composer/aws/aws-sdk-php/src/S3/S3Transfer/Models/DownloadFileRequest.php

raw symbols SCIP
1 <?php
2
3 namespace Aws\S3\S3Transfer\Models;
4
5 use Aws\S3\S3Transfer\Utils\FileDownloadHandler;
6
7 final class DownloadFileRequest
8 {
9 /** @var string */
10 private string $destination;
11
12 /**
13 * To decide whether an error should be raised
14 * if the destination file exists.
15 *
16 * @var bool
17 */
18 private bool $failsWhenDestinationExists;
19
20 /** @var DownloadRequest */
21 private DownloadRequest $downloadRequest;
22
23 /**
24 * @param string $destination
25 * @param bool $failsWhenDestinationExists
26 * @param DownloadRequest $downloadRequest
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 * @return string
47 */
48 public function getDestination(): string
49 {
50 return $this->destination;
51 }
52
53 /**
54 * @return bool
55 */
56 public function isFailsWhenDestinationExists(): bool
57 {
58 return $this->failsWhenDestinationExists;
59 }
60
61 /**
62 * @return DownloadRequest
63 */
64 public function getDownloadRequest(): DownloadRequest
65 {
66 return $this->downloadRequest;
67 }
68 }