@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | return $this->chunks( |
| 48 | 48 | $this->folder |
| 49 | - )->map(function (Chunk $chunk) { |
|
| 49 | + )->map(function(Chunk $chunk) { |
|
| 50 | 50 | return $chunk->getPath(); |
| 51 | 51 | })->toArray(); |
| 52 | 52 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | if (is_string($folder) && $this->chunksFolderExists($folder)) { |
| 74 | 74 | $this->folder = $folder; |
| 75 | - } elseif (empty($this->folder) || ! $this->chunksFolderExists($this->folder)) { |
|
| 75 | + } elseif (empty($this->folder) || !$this->chunksFolderExists($this->folder)) { |
|
| 76 | 76 | throw new StrategyException('Chunks folder cannot be empty'); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function __call($method, $parameters) |
| 97 | 97 | { |
| 98 | - if (! method_exists($this, $method)) { |
|
| 98 | + if (!method_exists($this, $method)) { |
|
| 99 | 99 | return $this->forwardCallTo($this->manager, $method, $parameters); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | foreach ($chunks as $chunk) { |
| 18 | 18 | $size = $this->chunksFilesystem()->size($chunk->getPath()); |
| 19 | 19 | |
| 20 | - if ($size < $chunk_size && ! $this->isLastChunk($chunk->getIndex(), $total_size, $chunk_size)) { |
|
| 20 | + if ($size < $chunk_size && !$this->isLastChunk($chunk->getIndex(), $total_size, $chunk_size)) { |
|
| 21 | 21 | return false; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function chunksFolderExists($folder = ''): bool |
| 20 | 20 | { |
| 21 | - if (! Str::startsWith($folder, $this->getChunksFolder())) { |
|
| 21 | + if (!Str::startsWith($folder, $this->getChunksFolder())) { |
|
| 22 | 22 | $folder = $this->getChunksFolder().$folder; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -38,18 +38,18 @@ discard block |
||
| 38 | 38 | $this->getChunksFolder() |
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | - if (app()->runningInConsole() && ! app()->runningUnitTests()) { |
|
| 41 | + if (app()->runningInConsole() && !app()->runningUnitTests()) { |
|
| 42 | 42 | $this->progress_bar = $this->output->createProgressBar( |
| 43 | 43 | count($folders) |
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | foreach ($folders as $folder) { |
| 48 | - if (! $this->deleteChunks($folder)) { |
|
| 48 | + if (!$this->deleteChunks($folder)) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if (app()->runningInConsole() && ! app()->runningUnitTests()) { |
|
| 52 | + if (app()->runningInConsole() && !app()->runningUnitTests()) { |
|
| 53 | 53 | $this->progress_bar->advance(); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function deleteChunks(string $folder): bool |
| 68 | 68 | { |
| 69 | - if (! $this->chunksFolderExists($folder)) { |
|
| 69 | + if (!$this->chunksFolderExists($folder)) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $deleted = $this->chunksFilesystem() |
| 77 | 77 | ->delete($chunk->getPath()); |
| 78 | 78 | |
| 79 | - if (! $deleted) { |
|
| 79 | + if (!$deleted) { |
|
| 80 | 80 | return false; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -260,7 +260,7 @@ |
||
| 260 | 260 | */ |
| 261 | 261 | public function store(string $folder, $options = []): Chunk |
| 262 | 262 | { |
| 263 | - if (! $this->path instanceof File) { |
|
| 263 | + if (!$this->path instanceof File) { |
|
| 264 | 264 | throw new ChunkyException('Path must be a file'); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | $files = $this->chunksFilesystem()->files($folder); |
| 182 | 182 | |
| 183 | 183 | return collect($files) |
| 184 | - ->map(function ($path, $key) use ($folder, $files) { |
|
| 184 | + ->map(function($path, $key) use ($folder, $files) { |
|
| 185 | 185 | $filename = str_replace($folder.DIRECTORY_SEPARATOR, '', $path); |
| 186 | 186 | $exploded_name = explode('_', $filename); |
| 187 | 187 | $index = array_shift($exploded_name); |
| 188 | 188 | $last = count($files) - 1 == $key; |
| 189 | 189 | |
| 190 | 190 | return new Chunk(intval($index), $path, $this->getChunksDisk(), $last); |
| 191 | - })->sortBy(function (Chunk $chunk) { |
|
| 191 | + })->sortBy(function(Chunk $chunk) { |
|
| 192 | 192 | return $chunk->getIndex(); |
| 193 | 193 | }); |
| 194 | 194 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $path = $this->fullPath($folder); |
| 202 | 202 | $default = $this->settings->defaultIndex(); |
| 203 | 203 | |
| 204 | - if (! $this->chunksFilesystem()->exists($path) && $index != $default) { |
|
| 204 | + if (!$this->chunksFilesystem()->exists($path) && $index != $default) { |
|
| 205 | 205 | return false; |
| 206 | 206 | } elseif ($this->chunksFilesystem()->exists($path)) { |
| 207 | 207 | if (ChunkySettings::INDEX_ZERO != $default) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | return count($this->chunksFilesystem()->files($path)) == $index; |
| 212 | 212 | } elseif ($index == $default) { |
| 213 | - if (! $this->chunksFilesystem()->makeDirectory($path)) { |
|
| 213 | + if (!$this->chunksFilesystem()->makeDirectory($path)) { |
|
| 214 | 214 | throw new ChunksIntegrityException("Cannot create chunks folder $path"); |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | public function addChunk(UploadedFile $file, int $index, string $folder): Chunk |
| 225 | 225 | { |
| 226 | 226 | // Check integrity |
| 227 | - if (! $this->checkChunkIntegrity($folder, $index)) { |
|
| 227 | + if (!$this->checkChunkIntegrity($folder, $index)) { |
|
| 228 | 228 | throw new ChunksIntegrityException("Uploaded chunk with index {$index} violates the integrity"); |
| 229 | 229 | } |
| 230 | 230 | |