Test Failed
Pull Request — master (#31)
by Filippo
10:26
created
src/ChunkyManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     public function addChunk(UploadedFile $file, int $index, string $folder): Chunk
180 180
     {
181 181
         // Check integrity
182
-        if (! $this->checkChunks($folder, $index)) {
182
+        if (!$this->checkChunks($folder, $index)) {
183 183
             throw new ChunksIntegrityException("Uploaded chunk with index {$index} violates the integrity");
184 184
         }
185 185
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $default = $this->settings->defaultIndex();
216 216
 
217
-        if (! $this->chunksFilesystem()->exists($folder) && $index != $default) {
217
+        if (!$this->chunksFilesystem()->exists($folder) && $index != $default) {
218 218
             return false;
219 219
         }
220 220
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         }
228 228
 
229 229
         if ($index == $default) {
230
-            if (! $this->chunksFilesystem()->makeDirectory($folder)) {
230
+            if (!$this->chunksFilesystem()->makeDirectory($folder)) {
231 231
                 throw new ChunksIntegrityException("Cannot create chunks folder $folder");
232 232
             }
233 233
         }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         foreach ($chunks as $chunk) {
247 247
             $size = $this->chunksFilesystem()->chunkSize($chunk->getPath());
248 248
 
249
-            if ($size < $chunk_size && ! $chunk->isLast()) {
249
+            if ($size < $chunk_size && !$chunk->isLast()) {
250 250
                 return false;
251 251
             }
252 252
 
Please login to merge, or discard this patch.
src/Handlers/MergeHandler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
         // Merge
50 50
         $chunks = $this->listChunks(
51 51
             $folder,
52
-        )->map(function (Chunk $item) {
52
+        )->map(function(Chunk $item) {
53 53
             return $item->getPath();
54 54
         });
55 55
 
56
-        if (! $this->chunksFilesystem()->isLocal()) {
56
+        if (!$this->chunksFilesystem()->isLocal()) {
57 57
             return $this->temporaryConcatenate($target, $chunks->toArray());
58 58
         }
59 59
 
60 60
         $merge = $chunks->first();
61
-        if (! $this->chunksFilesystem()->concatenate($merge, $chunks->toArray())) {
61
+        if (!$this->chunksFilesystem()->concatenate($merge, $chunks->toArray())) {
62 62
             throw new ChunkyException('Unable to concatenate chunks');
63 63
         }
64 64
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $total_size = $request->totalSizeInput();
142 142
 
143 143
         if (empty($connection = $this->settings()->connection())) {
144
-            if (! $this->checkChunksIntegrity($folder, $chunk_size, $total_size)) {
144
+            if (!$this->checkChunksIntegrity($folder, $chunk_size, $total_size)) {
145 145
                 throw new ChunksIntegrityException('Chunks total file size doesnt match with original file size');
146 146
             }
147 147
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     public function merge(string $chunks_folder, string $merge_path): string
164 164
     {
165 165
         // Check chunks folder
166
-        if (! $this->isValidChunksFolder($chunks_folder)) {
166
+        if (!$this->isValidChunksFolder($chunks_folder)) {
167 167
             throw new ChunkyException("Invalid chunks folder {$chunks_folder}");
168 168
         }
169 169
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $path = $this->concatenate($chunks_folder, $merge_path);
172 172
 
173 173
         // Final check and cleanup
174
-        if (! $path) {
174
+        if (!$path) {
175 175
             throw new ChunkyException('An error occurred while moving merge to destination');
176 176
         }
177 177
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
     public function __call($method, $parameters)
194 194
     {
195
-        if (! method_exists($this, $method)) {
195
+        if (!method_exists($this, $method)) {
196 196
             return $this->forwardCallTo($this->manager(), $method, $parameters);
197 197
         }
198 198
 
Please login to merge, or discard this patch.
src/ChunkyServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@
 block discarded – undo
65 65
         $this->app->bind(ChunksFilesystem::class, ChunksFilesystem::class);
66 66
         $this->app->bind(MergeFilesystem::class, MergeFilesystem::class);
67 67
 
68
-        $this->app->singleton(ChunkySettings::class, function (Container $app) {
68
+        $this->app->singleton(ChunkySettings::class, function(Container $app) {
69 69
             return new ChunkySettings($app->make('config'));
70 70
         });
71 71
 
72
-        $this->app->singleton(ChunkyManagerContract::class, function (Container $app) {
72
+        $this->app->singleton(ChunkyManagerContract::class, function(Container $app) {
73 73
             return new ChunkyManager($app->make(ChunkySettings::class));
74 74
         });
75 75
     }
Please login to merge, or discard this patch.
src/Support/ChunksFilesystem.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $files = $this->list($folder);
25 25
 
26 26
         return collect($files)
27
-            ->map(function ($path, $key) use ($folder, $files) {
27
+            ->map(function($path, $key) use ($folder, $files) {
28 28
                 $filename = str_replace($folder.DIRECTORY_SEPARATOR, '', $path);
29 29
                 $exploded_name = explode('_', $filename);
30 30
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
                 $last = count($files) - 1 == $key;
33 33
 
34 34
                 return new Chunk(intval($index), $path, $this->disk(), $last);
35
-            })->sortBy(function (Chunk $chunk) {
35
+            })->sortBy(function(Chunk $chunk) {
36 36
                 return $chunk->getIndex();
37 37
             });
38 38
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function store(Chunk $chunk, string $folder, $options = []): Chunk
88 88
     {
89
-        if (! $chunk->getOriginalPath() instanceof File) {
89
+        if (!$chunk->getOriginalPath() instanceof File) {
90 90
             throw new ChunkyException('Path must be a file');
91 91
         }
92 92
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function deleteChunk(Chunk $chunk): bool
118 118
     {
119
-        if (! $this->filesystem()->disk($this->disk())->exists($chunk->getPath())) {
119
+        if (!$this->filesystem()->disk($this->disk())->exists($chunk->getPath())) {
120 120
             return true;
121 121
         }
122 122
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $folder = $this->path($folder);
142 142
 
143
-        if (! $this->filesystem()->disk($this->disk())->exists($folder)) {
143
+        if (!$this->filesystem()->disk($this->disk())->exists($folder)) {
144 144
             return true;
145 145
         }
146 146
 
Please login to merge, or discard this patch.
src/Support/Filesystem.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function path(string $path): string
36 36
     {
37
-        if (! Str::startsWith($path, $this->folder)) {
37
+        if (!Str::startsWith($path, $this->folder)) {
38 38
             return $this->folder().$path;
39 39
         }
40 40
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function disk($disk = null): ?string
61 61
     {
62
-        if (! empty($disk) && is_string($disk)) {
62
+        if (!empty($disk) && is_string($disk)) {
63 63
             $this->disk = $disk;
64 64
         }
65 65
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function folder($folder = null): ?string
76 76
     {
77
-        if (! empty($folder) && is_string($folder)) {
77
+        if (!empty($folder) && is_string($folder)) {
78 78
             $suffix = Str::endsWith($folder, DIRECTORY_SEPARATOR) ? '' : DIRECTORY_SEPARATOR;
79 79
 
80 80
             $this->folder = $folder.$suffix;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
     public function __call($method, $parameters)
164 164
     {
165
-        if (! method_exists($this, $method)) {
165
+        if (!method_exists($this, $method)) {
166 166
             return $this->forwardCallTo($this->filesystem(), $method, $parameters);
167 167
         }
168 168
 
Please login to merge, or discard this patch.
src/Jobs/MergeChunks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
      */
49 49
     public function handle()
50 50
     {
51
-        if (! Chunky::checkChunksIntegrity($this->chunks_folder, $this->chunk_size, $this->total_size)) {
51
+        if (!Chunky::checkChunksIntegrity($this->chunks_folder, $this->chunk_size, $this->total_size)) {
52 52
             throw new ChunksIntegrityException('Chunks total file size doesnt match with original file size');
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/ChunkySettings.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             return '';
60 60
         }
61 61
 
62
-        if (! Str::endsWith($folder, '/')) {
62
+        if (!Str::endsWith($folder, '/')) {
63 63
             $folder .= DIRECTORY_SEPARATOR;
64 64
         }
65 65
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             return '';
90 90
         }
91 91
 
92
-        if (! Str::endsWith($folder, '/')) {
92
+        if (!Str::endsWith($folder, '/')) {
93 93
             $folder .= DIRECTORY_SEPARATOR;
94 94
         }
95 95
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         if ($this->handler === null) {
148 148
             $handler = Arr::get($this->config, 'merge.handler');
149 149
 
150
-            if (! class_exists($handler)) {
150
+            if (!class_exists($handler)) {
151 151
                 throw new ChunkyException("Undefined handler $handler");
152 152
             }
153 153
 
Please login to merge, or discard this patch.
src/Commands/ClearChunks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $this->manager = $manager;
53 53
 
54
-        if (! $this->confirmToProceed()) {
54
+        if (!$this->confirmToProceed()) {
55 55
             return;
56 56
         }
57 57
 
58 58
         $root = $this->manager->chunksFolder();
59 59
         $folder = $this->argument('folder');
60 60
 
61
-        if (! empty($folder)) {
61
+        if (!empty($folder)) {
62 62
             $root .= $folder;
63 63
             $this->deleteFolder($root);
64 64
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     private function deleteFolder(string $folder)
85 85
     {
86
-        if (! $this->manager->deleteChunks($folder)) {
86
+        if (!$this->manager->deleteChunks($folder)) {
87 87
             $this->error("An error occurred while deleting folder {$folder}");
88 88
 
89 89
             return;
Please login to merge, or discard this patch.