Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function download(string $path): PromiseInterface |
||
17 | { |
||
18 | $fileId = $this->bigFileId ?? $this->smallFileId ?? $this->audioFileId ?? $this->documentFileId ?? |
||
19 | $this->gifFileId ?? $this->mpeg4FileId ?? $this->photoFileId ?? $this->stickerFileId ?? $this->videoFileId ?? |
||
20 | $this->voiceFileId ?? $this->fileId; |
||
21 | return $this->api->getFile($fileId)->then( |
||
22 | function (File $file) { |
||
23 | return $this->api->downloadFile($file->filePath); |
||
24 | } |
||
25 | )->then( |
||
26 | function (StreamInterface $stream) use ($path) { |
||
27 | return file_put_contents($path, $stream); |
||
28 | } |
||
31 | } |