@@ -50,17 +50,17 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $this->manager = $manager; |
| 52 | 52 | |
| 53 | - if (! $this->confirmToProceed()) { |
|
| 53 | + if (!$this->confirmToProceed()) { |
|
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $root = $this->manager->getChunksFolder(); |
| 58 | 58 | $folder = $this->argument('folder'); |
| 59 | 59 | |
| 60 | - if (! empty($folder)) { |
|
| 60 | + if (!empty($folder)) { |
|
| 61 | 61 | $root .= $folder; |
| 62 | 62 | |
| 63 | - if (! $this->manager->chunksFilesystem()->delete($root)) { |
|
| 63 | + if (!$this->manager->chunksFilesystem()->delete($root)) { |
|
| 64 | 64 | $this->error("An error occurred while deleting folder {$root}"); |
| 65 | 65 | |
| 66 | 66 | return; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $this->info("folder {$root} cleared!"); |
| 70 | 70 | } else { |
| 71 | - if (! $this->manager->deleteAllChunks($this->output)) { |
|
| 71 | + if (!$this->manager->deleteAllChunks($this->output)) { |
|
| 72 | 72 | $this->error("An error occurred while deleting folder {$folder}"); |
| 73 | 73 | |
| 74 | 74 | return; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** {@inheritdoc} */ |
| 40 | 40 | public function disk($disk = null): ?string |
| 41 | 41 | { |
| 42 | - if (! empty($disk) && is_string($disk)) { |
|
| 42 | + if (!empty($disk) && is_string($disk)) { |
|
| 43 | 43 | $this->disk = $disk; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** {@inheritdoc} */ |
| 50 | 50 | public function folder($folder = null): ?string |
| 51 | 51 | { |
| 52 | - if (! empty($folder) && is_string($folder)) { |
|
| 52 | + if (!empty($folder) && is_string($folder)) { |
|
| 53 | 53 | $this->folder = $folder; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if (Str::startsWith($folder, $this->folder)) { |
| 69 | 69 | return $folder.$suffix; |
| 70 | - } elseif (! Str::endsWith($this->folder, $folder.$suffix)) { |
|
| 70 | + } elseif (!Str::endsWith($this->folder, $folder.$suffix)) { |
|
| 71 | 71 | return $this->folder.$folder.$suffix; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function store(Chunk $chunk, string $folder, $options = []): Chunk |
| 111 | 111 | { |
| 112 | - if (! $chunk->getOriginalPath() instanceof File) { |
|
| 112 | + if (!$chunk->getOriginalPath() instanceof File) { |
|
| 113 | 113 | throw new ChunkyException('Path must be a file'); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $folder = $this->fullPath($folder); |
| 146 | 146 | |
| 147 | - if (! $this->filesystem()->disk($this->disk)->exists($folder)) { |
|
| 147 | + if (!$this->filesystem()->disk($this->disk)->exists($folder)) { |
|
| 148 | 148 | return true; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function deleteChunk(Chunk $chunk): bool |
| 167 | 167 | { |
| 168 | - if (! $this->filesystem()->disk($this->disk)->exists($chunk->getPath())) { |
|
| 168 | + if (!$this->filesystem()->disk($this->disk)->exists($chunk->getPath())) { |
|
| 169 | 169 | return true; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | $files = $this->list($folder); |
| 191 | 191 | |
| 192 | 192 | return collect($files) |
| 193 | - ->map(function ($path, $key) use ($folder, $files) { |
|
| 193 | + ->map(function($path, $key) use ($folder, $files) { |
|
| 194 | 194 | $filename = str_replace($folder, '', $path); |
| 195 | 195 | $exploded_name = explode('_', $filename); |
| 196 | 196 | $index = array_shift($exploded_name); |
| 197 | 197 | $last = count($files) - 1 == $key; |
| 198 | 198 | |
| 199 | 199 | return new Chunk(intval($index), $path, $this->disk, $last); |
| 200 | - })->sortBy(function (Chunk $chunk) { |
|
| 200 | + })->sortBy(function(Chunk $chunk) { |
|
| 201 | 201 | return $chunk->getIndex(); |
| 202 | 202 | }); |
| 203 | 203 | } |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $this->addTemporaryContext($folder); |
| 252 | 252 | |
| 253 | - return $chunks->map(function (Chunk $chunk) use ($folder) { |
|
| 253 | + return $chunks->map(function(Chunk $chunk) use ($folder) { |
|
| 254 | 254 | $resource = $this->filesystem()->disk($this->disk)->readStream($chunk->getPath()); |
| 255 | 255 | $location = $this->temporaryFilesystem()->createTemporaryFile($folder); |
| 256 | 256 | |
| 257 | 257 | $stream = fopen($location, 'w+b'); |
| 258 | 258 | |
| 259 | - if (! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { |
|
| 259 | + if (!$stream || stream_copy_to_stream($resource, $stream) === false || !fclose($stream)) { |
|
| 260 | 260 | return false; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $stream = new AppendStream; |
| 278 | 278 | |
| 279 | 279 | foreach ($chunks as $chunk) { |
| 280 | - if (! $this->isLocal()) { |
|
| 280 | + if (!$this->isLocal()) { |
|
| 281 | 281 | $temp = fopen($chunk, 'rb'); |
| 282 | 282 | $stream->append($temp); |
| 283 | 283 | } else { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - if (! $this->isLocal()) { |
|
| 288 | + if (!$this->isLocal()) { |
|
| 289 | 289 | file_put_contents($first, $stream->getResource()); |
| 290 | 290 | |
| 291 | 291 | return $this->filesystem()->disk($this->disk)->put($destination, fopen($first, 'rb')); |