Skip to content

Commit

Permalink
Move the code deeper near to the use
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Dec 3, 2023
1 parent cbeb3be commit adb3f1e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Resumable.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,12 @@ public function handleChunk()
$chunkSize = (int) $this->resumableParam($this->resumableOption['chunkSize']);
$totalSize = (int) $this->resumableParam($this->resumableOption['totalSize']);

if (!$this->isChunkUploaded($identifier, $filename, $chunkNumber)) {
$chunkDir = $this->tmpChunkDir($identifier) . DIRECTORY_SEPARATOR;
$chunkFile = $chunkDir . $this->tmpChunkFilename($filename, $chunkNumber);

if (! $this->isChunkUploaded($identifier, $filename, $chunkNumber)) {
if (count($files) > 0) {
$firstFile = array_shift($files);
if ($firstFile instanceof UploadedFileInterface) {
$chunkDir = $this->tmpChunkDir($identifier) . DIRECTORY_SEPARATOR;
$chunkFile = $chunkDir . $this->tmpChunkFilename($filename, $chunkNumber);
$this->log('Moving chunk ' . $chunkNumber . ' for ' . $identifier);
$firstFile->moveTo($chunkFile);
} else {
Expand Down

0 comments on commit adb3f1e

Please sign in to comment.