Passed
Push — main ( 65165e...70414c )
by ikechukwu
12:45
created
Tests/TestCase.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function setUp(): void
10 10
     {
11
-      parent::setUp();
11
+        parent::setUp();
12 12
     }
13 13
 
14 14
     protected function defineDatabaseMigrations()
Please login to merge, or discard this patch.
src/migrations/2023_02_16_122711_create_file_uploads_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function up(): void
13 13
     {
14
-        Schema::create('file_uploads', function (Blueprint $table) {
14
+        Schema::create('file_uploads', function(Blueprint $table) {
15 15
             $table->id();
16 16
             $table->string('ref');
17 17
             $table->string('name');
Please login to merge, or discard this patch.
src/Support/BasicFileUpload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     public static function fileUpload(): bool|FileUploadModel|EloquentCollection
21 21
     {
22
-        if(self::$request->file()) {
22
+        if (self::$request->file()) {
23 23
             self::storeFiles();
24 24
 
25 25
             if (is_array(self::$request->file(self::$input))) {
Please login to merge, or discard this patch.
2023_03_03_135941_add_folder_and_hashed_fields_to_file_uploads_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function up(): void
13 13
     {
14
-        Schema::table('file_uploads', function (Blueprint $table) {
14
+        Schema::table('file_uploads', function(Blueprint $table) {
15 15
             $table->string('folder')->after('url')->nullable();
16 16
             $table->tinyInteger('hashed')->after('folder')->default(0);
17 17
         });
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function down(): void
24 24
     {
25
-        Schema::table('file_uploads', function (Blueprint $table) {
25
+        Schema::table('file_uploads', function(Blueprint $table) {
26 26
             $table->dropColumn(['folder', 'hashed']);
27 27
         });
28 28
     }
Please login to merge, or discard this patch.
...03_03_145756_increase_file_name_and_url_length_in_file_uploads_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function up(): void
13 13
     {
14
-        Schema::table('file_uploads', function (Blueprint $table) {
14
+        Schema::table('file_uploads', function(Blueprint $table) {
15 15
             $table->string('file_name', 510)->change();
16 16
             $table->string('url', 765)->change();
17 17
         });
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function down(): void
24 24
     {
25
-        Schema::table('file_uploads', function (Blueprint $table) {
25
+        Schema::table('file_uploads', function(Blueprint $table) {
26 26
             $table->string('file_name', '255')->change();
27 27
             $table->string('url', '255')->change();
28 28
         });
Please login to merge, or discard this patch.
src/Support/TemporaryFileUpload.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
      * @param array $files
28 28
      * @return  ?bool
29 29
      */
30
-    public static function removeFiles(array $files = []):  ?bool
30
+    public static function removeFiles(array $files = []): ?bool
31 31
     {
32 32
         foreach ($files as $file) {
33 33
             $file = str_replace(self::storageDisk()->path('tmp'), '', $file);
34
-            self::storageDisk()->delete('tmp' . $file);
34
+            self::storageDisk()->delete('tmp'.$file);
35 35
         }
36 36
 
37 37
         return true;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
         $i = 1;
82 82
 
83 83
         foreach (self::$request->file(self::$input) as $file) {
84
-            $tmp = $fileName . "_{$i}" . self::getExtension($file);
84
+            $tmp = $fileName."_{$i}".self::getExtension($file);
85 85
             $disk->putFileAs("", $file, $tmp);
86 86
             $tmpFiles[] = self::storageDisk()->path("tmp/{$tmp}");
87 87
 
88
-            $i ++;
88
+            $i++;
89 89
         }
90 90
 
91 91
         return $tmpFiles;
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
      */
101 101
     protected static function saveSingleFile(?string $fileName = null): bool|array
102 102
     {
103
-        $tmp = $fileName . self::getExtension();
103
+        $tmp = $fileName.self::getExtension();
104 104
 
105 105
         self::provideDisk()->putFileAs("",
106 106
                 self::$request->file(self::$input),
107
-                $fileName . self::getExtension());
107
+                $fileName.self::getExtension());
108 108
 
109 109
         return [self::storageDisk()->path("tmp/{$tmp}")];
110 110
     }
Please login to merge, or discard this patch.
src/Foundation/FileUpload.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
         $i = 1;
80 80
         foreach (self::$request->file(self::$input) as $file) {
81
-            $disk->putFileAs("", $file, self::$fileName . "_{$i}" .
81
+            $disk->putFileAs("", $file, self::$fileName."_{$i}".
82 82
                     self::getExtension($file));
83
-            $i ++;
83
+            $i++;
84 84
         }
85 85
 
86 86
         return true;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         self::provideDisk()->putFileAs("",
99 99
                 self::$request->file(self::$input),
100
-                self::$fileName . self::getExtension());
100
+                self::$fileName.self::getExtension());
101 101
 
102 102
         return true;
103 103
     }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 
131 131
             $file = str_replace(self::storageDisk()
132 132
                         ->path(self::$uploadPath), '', $file);
133
-            self::storageDisk()->delete(self::$uploadPath . $file);
133
+            self::storageDisk()->delete(self::$uploadPath.$file);
134 134
 
135
-            $i ++;
135
+            $i++;
136 136
         }
137 137
 
138 138
         return true;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
         $file = str_replace(self::storageDisk()
151 151
                 ->path(self::$uploadPath), '', self::$request->file(self::$input));
152
-        self::storageDisk()->delete(self::$uploadPath . $file);
152
+        self::storageDisk()->delete(self::$uploadPath.$file);
153 153
 
154 154
         return true;
155 155
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     protected static function getName($file = null, $i = null): string
175 175
     {
176 176
         if ($file && $i) {
177
-            return self::$name ? self::$name . "_{$i}"
177
+            return self::$name ? self::$name."_{$i}"
178 178
                 : $file->getClientOriginalName();
179 179
         }
180 180
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     protected static function setFileName(): string
191 191
     {
192
-        return time() . Str::random(40);
192
+        return time().Str::random(40);
193 193
     }
194 194
 
195 195
     /**
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
     protected static function getExtension($file = null): string
233 233
     {
234 234
         if ($file) {
235
-            return '.' . $file->getClientOriginalExtension();
235
+            return '.'.$file->getClientOriginalExtension();
236 236
         }
237 237
 
238
-        return '.' . self::$request->file(self::$input)
238
+        return '.'.self::$request->file(self::$input)
239 239
                 ->getClientOriginalExtension();
240 240
     }
241 241
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     protected static function getRelativeFilePath($fileName): string
249 249
     {
250
-        return self::$uploadPath . "/" . $fileName;
250
+        return self::$uploadPath."/".$fileName;
251 251
     }
252 252
 
253 253
     /**
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
     protected static function fileNameAndPath($file = null, $i = null): array
281 281
     {
282 282
         if ($file && $i) {
283
-            $fileName = self::$fileName . "_{$i}" . self::getExtension($file);
283
+            $fileName = self::$fileName."_{$i}".self::getExtension($file);
284 284
             return [$fileName, self::getRelativeFilePath($fileName)];
285 285
         }
286 286
 
287
-        $fileName = self::$fileName . self::getExtension();
287
+        $fileName = self::$fileName.self::getExtension();
288 288
         return [$fileName, self::getRelativeFilePath($fileName)];
289 289
     }
290 290
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
         foreach (self::$request->file(self::$input) as $file) {
327 327
             $data[] = self::getFileModelData($file, $i);
328
-            $i ++;
328
+            $i++;
329 329
         }
330 330
 
331 331
         if (FileUploadModel::insert($data)) {
Please login to merge, or discard this patch.
src/Facade/FileUploadLogic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
         }
55 55
 
56 56
         if (self::$folder) {
57
-            self::$uploadPath .= ("/" . self::$folder);
57
+            self::$uploadPath .= ("/".self::$folder);
58 58
         }
59 59
     }
60 60
 
Please login to merge, or discard this patch.
Tests/EventsTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     public function test_fires_clamav_queued_file_scan_event(): void
26 26
     {
27 27
         $event = Event::fake();
28
-        $file = __DIR__ . '/file/lorem-ipsum.pdf';
29
-        if (! is_dir($tmpDir = __DIR__ . '/tmp')) {
28
+        $file = __DIR__.'/file/lorem-ipsum.pdf';
29
+        if (!is_dir($tmpDir = __DIR__.'/tmp')) {
30 30
             mkdir($tmpDir, 0755, true);
31 31
         }
32 32
 
33
-        $tmpFile = $tmpDir . '/lorem-ipsum.pdf';
33
+        $tmpFile = $tmpDir.'/lorem-ipsum.pdf';
34 34
         $this->assertTrue(copy($file, $tmpFile));
35 35
 
36 36
         ClamavQueuedFileScan::dispatch([$tmpFile], [], (string) Str::uuid());
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
     public function test_fires_clamav_file_upload_listener(): void
41 41
     {
42 42
         $event = Event::fake();
43
-        $file = __DIR__ . '/file/lorem-ipsum.pdf';
44
-        if (! is_dir($tmpDir = __DIR__ . '/tmp')) {
43
+        $file = __DIR__.'/file/lorem-ipsum.pdf';
44
+        if (!is_dir($tmpDir = __DIR__.'/tmp')) {
45 45
             mkdir($tmpDir, 0755, true);
46 46
         }
47 47
 
48
-        $tmpFile = $tmpDir . '/lorem-ipsum.pdf';
48
+        $tmpFile = $tmpDir.'/lorem-ipsum.pdf';
49 49
         $this->assertTrue(copy($file, $tmpFile));
50 50
 
51 51
         ClamavQueuedFileScan::dispatch([$tmpFile], [], (string) Str::uuid());
Please login to merge, or discard this patch.