PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 4.9.2
WP STAGING – WordPress Backup, Restore, Migration & Clone v4.9.2
4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Backup / Dto / File / BackupItemDto.php
wp-staging / Backup / Dto / File Last commit date
BackupItemDto.php 7 months ago ExtractorDto.php 2 weeks ago
BackupItemDto.php
133 lines
1 <?php
2
3 namespace WPStaging\Backup\Dto\File;
4
5 use WPStaging\Backup\Interfaces\IndexLineInterface;
6
7 /**
8 * This class is used for representation of item/file in the backup when listing that item/file in the UI.
9 *
10 * @package WPStaging\Backup\Dto\File
11 */
12 class BackupItemDto
13 {
14 /**
15 * The offset of the file in the backup
16 * @var int
17 */
18 private $offset;
19
20 /**
21 * The line index of the file in the backup
22 * @var int
23 */
24 private $index;
25
26 /** @var string */
27 private $identifiablePath;
28
29 /** @var string */
30 private $path;
31
32 /** @var string */
33 private $size;
34
35 /** @var bool */
36 private $isDatabase;
37
38 public function __construct()
39 {
40 $this->offset = 0;
41 $this->index = 0;
42 $this->path = '';
43 $this->size = '';
44 $this->isDatabase = false;
45 }
46
47 public static function fromIndexLineDto(IndexLineInterface $indexLineDto): BackupItemDto
48 {
49 $backupFile = new BackupItemDto();
50 $backupFile->setIdentifiablePath($indexLineDto->getIdentifiablePath());
51 $backupFile->setSize((string)$indexLineDto->getUncompressedSize());
52 $backupFile->setIsDatabase(false);
53
54 return $backupFile;
55 }
56
57 public function setOffset(int $offset)
58 {
59 $this->offset = $offset;
60 }
61
62 public function setIndex(int $index)
63 {
64 $this->index = $index;
65 }
66
67 public function setIdentifiablePath(string $identifiablePath)
68 {
69 $this->identifiablePath = $identifiablePath;
70 }
71
72 public function setPath(string $path)
73 {
74 $this->path = $path;
75 }
76
77 public function setSize(string $size)
78 {
79 $this->size = $size;
80 }
81
82 public function setIsDatabase(bool $isDatabase)
83 {
84 $this->isDatabase = $isDatabase;
85 }
86
87 public function getOffset(): int
88 {
89 return $this->offset;
90 }
91
92 public function getIndex(): int
93 {
94 return $this->index;
95 }
96
97 public function getIdentifiablePath(): string
98 {
99 return $this->identifiablePath;
100 }
101
102 public function getPath(): string
103 {
104 return $this->path;
105 }
106
107 public function getSize(): string
108 {
109 return $this->size;
110 }
111
112 public function isDatabase(): bool
113 {
114 return $this->isDatabase;
115 }
116
117 public function toArray(): array
118 {
119 return [
120 0 => $this->index,
121 1 => $this->path,
122 2 => $this->offset,
123 3 => $this->size,
124 4 => $this->isDatabase,
125 'offset' => $this->offset,
126 'index' => $this->index,
127 'path' => $this->path,
128 'size' => $this->size,
129 'isDatabase' => $this->isDatabase,
130 ];
131 }
132 }
133