@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | protected function mergeChunks(string $destination, array $chunks): bool |
| 14 | 14 | { |
| 15 | - if (! $this->chunksManager->chunksFilesystem()->concatenate($destination, $chunks)) { |
|
| 15 | + if (!$this->chunksManager->chunksFilesystem()->concatenate($destination, $chunks)) { |
|
| 16 | 16 | throw new StrategyException('Unable to concatenate chunks'); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // Retrieve chunks |
| 28 | 28 | $chunks = $this->chunksManager->chunks( |
| 29 | 29 | $this->chunksFolder() |
| 30 | - )->map(function (Chunk $item) { |
|
| 30 | + )->map(function(Chunk $item) { |
|
| 31 | 31 | return $item->getPath(); |
| 32 | 32 | }); |
| 33 | 33 | $chunk = $this->chunksManager->chunks( |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $this->mergeManager->getMergeOptions() |
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | - if (! $path) { |
|
| 48 | + if (!$path) { |
|
| 49 | 49 | throw new StrategyException('An error occurred while moving merge to destination'); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** {@inheritdoc} */ |
| 16 | 16 | public function disk($disk = null): ?string |
| 17 | 17 | { |
| 18 | - if (! empty($disk) && is_string($disk)) { |
|
| 18 | + if (!empty($disk) && is_string($disk)) { |
|
| 19 | 19 | $this->disk = $disk; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** {@inheritdoc} */ |
| 26 | 26 | public function folder($folder = null): ?string |
| 27 | 27 | { |
| 28 | - if (! empty($folder) && is_string($folder)) { |
|
| 28 | + if (!empty($folder) && is_string($folder)) { |
|
| 29 | 29 | $this->folder = $folder; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | if (Str::startsWith($folder, $this->folder)) { |
| 45 | 45 | return $folder.$suffix; |
| 46 | - } elseif (! Str::endsWith($this->folder, $folder.$suffix)) { |
|
| 46 | + } elseif (!Str::endsWith($this->folder, $folder.$suffix)) { |
|
| 47 | 47 | return $this->folder.$folder.$suffix; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function store(Chunk $chunk, string $folder, $options = []): Chunk |
| 87 | 87 | { |
| 88 | - if (! $chunk->getOriginalPath() instanceof File) { |
|
| 88 | + if (!$chunk->getOriginalPath() instanceof File) { |
|
| 89 | 89 | throw new ChunkyException('Path must be a file'); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $folder = $this->fullPath($folder); |
| 117 | 117 | |
| 118 | - if (! $this->filesystem()->disk($this->disk)->exists($folder)) { |
|
| 118 | + if (!$this->filesystem()->disk($this->disk)->exists($folder)) { |
|
| 119 | 119 | return true; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function deleteChunk(Chunk $chunk): bool |
| 140 | 140 | { |
| 141 | - if (! $this->filesystem()->disk($this->disk)->exists($chunk->getPath())) { |
|
| 141 | + if (!$this->filesystem()->disk($this->disk)->exists($chunk->getPath())) { |
|
| 142 | 142 | return true; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | $files = $this->list($folder); |
| 164 | 164 | |
| 165 | 165 | return collect($files) |
| 166 | - ->map(function ($path, $key) use ($folder, $files) { |
|
| 166 | + ->map(function($path, $key) use ($folder, $files) { |
|
| 167 | 167 | $filename = str_replace($folder, '', $path); |
| 168 | 168 | $exploded_name = explode('_', $filename); |
| 169 | 169 | $index = array_shift($exploded_name); |
| 170 | 170 | $last = count($files) - 1 == $key; |
| 171 | 171 | |
| 172 | 172 | return new Chunk(intval($index), $path, $this->disk, $last); |
| 173 | - })->sortBy(function (Chunk $chunk) { |
|
| 173 | + })->sortBy(function(Chunk $chunk) { |
|
| 174 | 174 | return $chunk->getIndex(); |
| 175 | 175 | }); |
| 176 | 176 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | public function addChunk(UploadedFile $file, int $index, string $folder): Chunk |
| 152 | 152 | { |
| 153 | 153 | // Check integrity |
| 154 | - if (! $this->checkChunkIntegrity($folder, $index)) { |
|
| 154 | + if (!$this->checkChunkIntegrity($folder, $index)) { |
|
| 155 | 155 | throw new ChunksIntegrityException("Uploaded chunk with index {$index} violates the integrity"); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $progress_bar = $this->hasProgressBar($output, count($folders)); |
| 186 | 186 | |
| 187 | 187 | foreach ($folders as $folder) { |
| 188 | - if (! $this->deleteChunkFolder($folder)) { |
|
| 188 | + if (!$this->deleteChunkFolder($folder)) { |
|
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function handleMerge(string $folder, string $destination, int $chunk_size, int $total_size) |
| 233 | 233 | { |
| 234 | - if (! $this->checkFilesIntegrity($folder, $chunk_size, $total_size)) { |
|
| 234 | + if (!$this->checkFilesIntegrity($folder, $chunk_size, $total_size)) { |
|
| 235 | 235 | throw new ChunksIntegrityException('Chunks total file size doesnt match with original file size'); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $path = $this->chunksFilesystem()->fullPath($folder); |
| 259 | 259 | $default = $this->settings->defaultIndex(); |
| 260 | 260 | |
| 261 | - if (! $this->chunksFilesystem()->exists($path) && $index != $default) { |
|
| 261 | + if (!$this->chunksFilesystem()->exists($path) && $index != $default) { |
|
| 262 | 262 | return false; |
| 263 | 263 | } elseif ($this->chunksFilesystem()->exists($path)) { |
| 264 | 264 | if (ChunkySettings::INDEX_ZERO != $default) { |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | return $this->chunksFilesystem()->chunksCount($path) == $index; |
| 269 | 269 | } elseif ($index == $default) { |
| 270 | - if (! $this->chunksFilesystem()->makeDirectory($path)) { |
|
| 270 | + if (!$this->chunksFilesystem()->makeDirectory($path)) { |
|
| 271 | 271 | throw new ChunksIntegrityException("Cannot create chunks folder $path"); |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | foreach ($chunks as $chunk) { |
| 287 | 287 | $size = $this->chunksFilesystem->chunkSize($chunk->getPath()); |
| 288 | 288 | |
| 289 | - if ($size < $chunk_size && ! $chunk->isLast()) { |
|
| 289 | + if ($size < $chunk_size && !$chunk->isLast()) { |
|
| 290 | 290 | return false; |
| 291 | 291 | } |
| 292 | 292 | |