@@ -59,6 +59,9 @@ class RestoringChunk implements JsonSerializable, IDeserializable {
59
59
/** @var string[] */
60
60
private $ files = [];
61
61
62
+ /** @var RestoringChunkPart */
63
+ private $ parts = [];
64
+
62
65
/** @var int */
63
66
private $ count = 0 ;
64
67
@@ -69,42 +72,33 @@ class RestoringChunk implements JsonSerializable, IDeserializable {
69
72
private $ checksum = '' ;
70
73
71
74
/** @var bool */
72
- private $ encrypted = false ;
75
+ private $ stored = false ;
73
76
74
77
/** @var bool */
75
78
private $ staticName = false ;
76
79
77
- /** @var string */
78
- private $ encryptedChecksum = '' ;
79
-
80
80
81
81
/**
82
- * only add $name for specific Chunk.
83
- *
84
82
* RestoringChunk constructor.
85
83
*/
86
- public function __construct (string $ name = '' ) {
87
- if ($ name === '' ) {
88
- $ name = $ this ->uuid ();
89
- } else {
90
- $ this ->staticName = true ;
84
+ public function __construct (string $ name = '' , bool $ staticName = false ) {
85
+ $ this ->staticName = $ staticName ;
86
+ if (!$ staticName ) {
87
+ if ($ name !== '' ) {
88
+ $ name .= '- ' ;
89
+ }
90
+ $ name .= $ this ->uuid ();
91
91
}
92
92
93
93
$ this ->name = $ name ;
94
94
}
95
95
96
96
97
97
/**
98
- * @param string $ext
99
- *
100
98
* @return string
101
99
*/
102
- public function getName (string $ ext = '' ): string {
103
- if ($ ext === '' ) {
104
- return $ this ->name ;
105
- }
106
-
107
- return $ this ->name . '. ' . $ ext ;
100
+ public function getName (): string {
101
+ return $ this ->name ;
108
102
}
109
103
110
104
/**
@@ -146,21 +140,10 @@ public function getFilename(): string {
146
140
return $ this ->getName ();
147
141
}
148
142
149
- if ($ this ->isEncrypted ()) {
150
- return $ this ->getName ();
151
- }
152
-
153
143
return $ this ->getName () . '.zip ' ;
154
144
}
155
145
156
146
157
- // /**
158
- // * @return int
159
- // */
160
- // public function count(): int {
161
- // return sizeof($this->files);
162
- // }
163
- //
164
147
/**
165
148
* @return int
166
149
*/
@@ -233,25 +216,6 @@ public function setSize(int $size): self {
233
216
}
234
217
235
218
236
- /**
237
- * @param bool $encrypted
238
- *
239
- * @return RestoringChunk
240
- */
241
- public function setEncrypted (bool $ encrypted ): self {
242
- $ this ->encrypted = $ encrypted ;
243
-
244
- return $ this ;
245
- }
246
-
247
- /**
248
- * @return bool
249
- */
250
- public function isEncrypted (): bool {
251
- return $ this ->encrypted ;
252
- }
253
-
254
-
255
219
/**
256
220
* @return string
257
221
*/
@@ -270,36 +234,6 @@ public function setChecksum(string $checksum): self {
270
234
return $ this ;
271
235
}
272
236
273
- /**
274
- * @param string $checksum
275
- *
276
- * @return bool
277
- */
278
- public function compareChecksum (string $ checksum ): bool {
279
- if ($ this ->isEncrypted ()) {
280
- return ($ this ->getEncryptedChecksum () === $ checksum );
281
- }
282
-
283
- return ($ this ->getChecksum () === $ checksum );
284
- }
285
-
286
- /**
287
- * @return string
288
- */
289
- public function getEncryptedChecksum (): string {
290
- return $ this ->encryptedChecksum ;
291
- }
292
-
293
- /**
294
- * @param string $encryptedChecksum
295
- *
296
- * @return RestoringChunk
297
- */
298
- public function setEncryptedChecksum (string $ encryptedChecksum ): self {
299
- $ this ->encryptedChecksum = $ encryptedChecksum ;
300
-
301
- return $ this ;
302
- }
303
237
304
238
/**
305
239
* @param string $content
@@ -331,10 +265,8 @@ public function import(array $data): IDeserializable {
331
265
->setCount ($ this ->getInt ('count ' , $ data ))
332
266
->setSize ($ this ->getInt ('size ' , $ data ))
333
267
->setContent ($ this ->get ('content ' , $ data ))
334
- ->setEncrypted ($ this ->getBool ('encrypted ' , $ data ))
335
268
->setStaticName ($ this ->getBool ('staticName ' , $ data ))
336
- ->setChecksum ($ this ->get ('checksum ' , $ data ))
337
- ->setEncryptedChecksum ($ this ->get ('encryptedChecksum ' , $ data ));
269
+ ->setChecksum ($ this ->get ('checksum ' , $ data ));
338
270
339
271
return $ this ;
340
272
}
@@ -358,10 +290,8 @@ public function jsonSerialize(): array {
358
290
'name ' => $ this ->getName (),
359
291
'count ' => $ this ->getCount (),
360
292
'size ' => $ this ->getSize (),
361
- 'encrypted ' => $ this ->isEncrypted (),
362
293
'staticName ' => $ this ->isStaticName (),
363
- 'checksum ' => $ this ->getChecksum (),
364
- 'encryptedChecksum ' => $ this ->getEncryptedChecksum ()
294
+ 'checksum ' => $ this ->getChecksum ()
365
295
];
366
296
367
297
if ($ this ->getContent () !== '' ) {
@@ -371,6 +301,5 @@ public function jsonSerialize(): array {
371
301
return $ arr ;
372
302
}
373
303
374
-
375
304
}
376
305
0 commit comments