FileCopierTaskDto.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Staging\Dto\Task; |
| 4 | |
| 5 | use WPStaging\Framework\Job\Dto\AbstractTaskDto; |
| 6 | use WPStaging\Staging\Dto\Service\BigFileDto; |
| 7 | |
| 8 | class FileCopierTaskDto extends AbstractTaskDto |
| 9 | { |
| 10 | |
| 11 | public $filePath = ''; |
| 12 | |
| 13 | |
| 14 | public $destinationPath = ''; |
| 15 | |
| 16 | |
| 17 | public $indexPath = ''; |
| 18 | |
| 19 | |
| 20 | public $writtenBytesTotal = 0; |
| 21 | |
| 22 | |
| 23 | public $fileSize = 0; |
| 24 | |
| 25 | public function getBigFileDto(): BigFileDto |
| 26 | { |
| 27 | $bigFileDto = new BigFileDto(); |
| 28 | $bigFileDto->setFilePath($this->filePath); |
| 29 | $bigFileDto->setDestinationPath($this->destinationPath); |
| 30 | $bigFileDto->setIndexPath($this->indexPath); |
| 31 | $bigFileDto->setWrittenBytesTotal($this->writtenBytesTotal); |
| 32 | $bigFileDto->setFileSize($this->fileSize); |
| 33 | |
| 34 | return $bigFileDto; |
| 35 | } |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | public function setBigFileDto($bigFileDto) |
| 44 | { |
| 45 | if ($bigFileDto === null) { |
| 46 | $this->reset(); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | $this->filePath = $bigFileDto->getFilePath(); |
| 51 | $this->destinationPath = $bigFileDto->getDestinationPath(); |
| 52 | $this->indexPath = $bigFileDto->getIndexPath(); |
| 53 | $this->writtenBytesTotal = $bigFileDto->getWrittenBytesTotal(); |
| 54 | $this->fileSize = $bigFileDto->getFileSize(); |
| 55 | } |
| 56 | |
| 57 | public function reset() |
| 58 | { |
| 59 | $this->filePath = ''; |
| 60 | $this->destinationPath = ''; |
| 61 | $this->indexPath = ''; |
| 62 | $this->writtenBytesTotal = 0; |
| 63 | $this->fileSize = 0; |
| 64 | } |
| 65 | } |
| 66 |