Test Failed
Pull Request — master (#36)
by Filippo
04:47
created
src/Http/Requests/AddChunkRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
 
108 108
         foreach (config('chunky.validation') as $input => $config) {
109 109
             if (
110
-                ! in_array($input, ['index', 'file', 'chunkSize', 'totalSize'])
110
+                !in_array($input, ['index', 'file', 'chunkSize', 'totalSize'])
111 111
                 && Arr::has($config, 'key')
112 112
                 && Arr::has($config, 'rules')
113 113
             ) {
Please login to merge, or discard this patch.
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/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.
src/Handlers/MergeHandler.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
      */
52 52
     private function concatenate(string $folder, string $target): string
53 53
     {
54
-        if (! $this->chunksFilesystem()->isLocal()) {
54
+        if (!$this->chunksFilesystem()->isLocal()) {
55 55
             return $this->temporaryConcatenate($target, $this->listChunks($folder));
56 56
         }
57 57
 
58
-        $chunks = $this->listChunks($folder)->map(function (Chunk $item) {
58
+        $chunks = $this->listChunks($folder)->map(function(Chunk $item) {
59 59
             return $item->getPath();
60 60
         });
61 61
         $merge = $chunks->first();
62 62
 
63
-        if (! $this->chunksFilesystem()->concatenate($merge, $chunks->toArray())) {
63
+        if (!$this->chunksFilesystem()->concatenate($merge, $chunks->toArray())) {
64 64
             throw new ChunkyException('Unable to concatenate chunks');
65 65
         }
66 66
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     private function temporaryConcatenate(string $target, Collection $chunks)
83 83
     {
84 84
         $stream = new AppendStream;
85
-        $chunks->each(function (Chunk $chunk) use ($stream) {
85
+        $chunks->each(function(Chunk $chunk) use ($stream) {
86 86
             $path = $this->temp_filesystem->store('tmp-'.$chunk->getFilename(), $this->chunksFilesystem()->readChunk($chunk->getPath()));
87 87
             $stream->append($this->temp_filesystem->readFile($path));
88 88
         });
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $total_size = $request->totalSizeInput();
132 132
 
133 133
         if (empty($connection = $this->settings()->connection())) {
134
-            if (! $this->checkChunksIntegrity($folder, $chunk_size, $total_size)) {
134
+            if (!$this->checkChunksIntegrity($folder, $chunk_size, $total_size)) {
135 135
                 throw new ChunksIntegrityException('Chunks total file size doesnt match with original file size');
136 136
             }
137 137
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     public function merge(string $chunks_folder, string $merge_path): string
154 154
     {
155 155
         // Check chunks folder
156
-        if (! $this->isValidChunksFolder($chunks_folder)) {
156
+        if (!$this->isValidChunksFolder($chunks_folder)) {
157 157
             throw new ChunkyException("Invalid chunks folder {$chunks_folder}");
158 158
         }
159 159
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $path = $this->concatenate($chunks_folder, $merge_path);
162 162
 
163 163
         // Final check and cleanup
164
-        if (! $path) {
164
+        if (!$path) {
165 165
             throw new ChunkyException('An error occurred while moving merge to destination');
166 166
         }
167 167
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
     public function __call($method, $parameters)
184 184
     {
185
-        if (! method_exists($this, $method)) {
185
+        if (!method_exists($this, $method)) {
186 186
             return $this->forwardCallTo($this->manager(), $method, $parameters);
187 187
         }
188 188
 
Please login to merge, or discard this patch.
src/ChunkyServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     private function registerBindings()
66 66
     {
67
-        $this->app->singleton(TempFilesystem::class, function () {
67
+        $this->app->singleton(TempFilesystem::class, function() {
68 68
             $config = $this->app->make('config');
69 69
             $filesystem = new TempFilesystem(app()->make(Factory::class));
70 70
 
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
         $this->app->bind(ChunksFilesystem::class, ChunksFilesystem::class);
78 78
         $this->app->bind(MergeFilesystem::class, MergeFilesystem::class);
79 79
 
80
-        $this->app->singleton(ChunkySettings::class, function (Container $app) {
80
+        $this->app->singleton(ChunkySettings::class, function(Container $app) {
81 81
             return new ChunkySettings($app->make('config'));
82 82
         });
83 83
 
84
-        $this->app->singleton(ChunkyManagerContract::class, function (Container $app) {
84
+        $this->app->singleton(ChunkyManagerContract::class, function(Container $app) {
85 85
             return new ChunkyManager($app->make(ChunkySettings::class));
86 86
         });
87 87
     }
Please login to merge, or discard this patch.