Test Failed
Push — master ( 7e7df5...676302 )
by Mostafa
07:11 queued 03:20
created
src/Jobs/ProcessFFMpeg.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
         try {
51 51
             if ($this->standalone) {
52 52
                 $this->standalone->handleFFMpegQueue();
53
-            }
54
-            else {
53
+            } else {
55 54
                 /** @var \Illuminate\Database\Eloquent\Model $class */
56 55
                 $class = $this->model;
57 56
                 $modelNotSaved = true;
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
             }
77 76
 
78 77
             $this->updateStatus(true, false);
79
-        }
80
-        catch (FileNotFoundException | Exception $e) {
78
+        } catch (FileNotFoundException | Exception $e) {
81 79
             $this->updateStatus(false, false, $e->getMessage());
82 80
 
83 81
             throw new Exception($e->getMessage());
Please login to merge, or discard this patch.
src/Storage/Attachment.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @param string $style
167 167
      * @return RedirectResponse|StreamedResponse|null
168 168
      */
169
-    public function download(string $style = 'original'): StreamedResponse|RedirectResponse|null
169
+    public function download(string $style = 'original'): StreamedResponse | RedirectResponse | null
170 170
     {
171 171
         $path = $this->prepareStylePath($style);
172 172
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      * @param string|null $key
184 184
      * @return object|string|integer|null
185 185
      */
186
-    public function meta(string $key = null): object|int|string|null
186
+    public function meta(string $key = null): object | int | string | null
187 187
     {
188 188
         if ($key) {
189 189
             $meta = $this->output;
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
             $this->type = $this->output['type'];
67 67
 
68 68
             return true;
69
-        }
70
-        else {
69
+        } else {
71 70
             return false;
72 71
         }
73 72
     }
@@ -85,8 +84,7 @@  discard block
 block discarded – undo
85 84
             $this->type = $this->output['type'];
86 85
 
87 86
             return true;
88
-        }
89
-        else {
87
+        } else {
90 88
             return false;
91 89
         }
92 90
     }
@@ -106,8 +104,7 @@  discard block
 block discarded – undo
106 104
         if (isset($this->file)) {
107 105
             if ($this->file == LARUPLOAD_NULL) {
108 106
                 $this->clean($model->id);
109
-            }
110
-            else {
107
+            } else {
111 108
                 if (!$this->keepOldFiles) {
112 109
                     $this->clean($model->id);
113 110
                 }
@@ -120,8 +117,7 @@  discard block
 block discarded – undo
120 117
             }
121 118
 
122 119
             $model = $this->setAttributes($model);
123
-        }
124
-        else if (isset($this->cover)) {
120
+        } else if (isset($this->cover)) {
125 121
             $this->setCover($model->id);
126 122
 
127 123
             $model = $this->setAttributes($model);
@@ -213,8 +209,7 @@  discard block
 block discarded – undo
213 209
             if ($style == LaruploadEnum::COVER_FOLDER and !$this->generateCover) {
214 210
                 $styles->{$style} = null;
215 211
                 continue;
216
-            }
217
-            else if ($style == LaruploadEnum::STREAM_FOLDER and empty($this->streams)) {
212
+            } else if ($style == LaruploadEnum::STREAM_FOLDER and empty($this->streams)) {
218 213
                 unset($styles->{$style});
219 214
                 continue;
220 215
             }
@@ -408,8 +403,7 @@  discard block
 block discarded – undo
408 403
             case LaruploadEnum::VIDEO:
409 404
                 if ($this->ffmpegQueue) {
410 405
                     $this->initializeFFMpegQueue($id, $class, $standalone);
411
-                }
412
-                else {
406
+                } else {
413 407
                     $this->handleVideoStyles($id);
414 408
                 }
415 409
 
@@ -461,8 +455,7 @@  discard block
 block discarded – undo
461 455
 
462 456
         if ($maxQueueNum == 0) {
463 457
             $flag = true;
464
-        }
465
-        else {
458
+        } else {
466 459
             $availableQueues = DB::table(LaruploadEnum::FFMPEG_QUEUE_TABLE)->where('status', 0)->count();
467 460
 
468 461
             if ($availableQueues < $maxQueueNum) {
@@ -496,8 +489,7 @@  discard block
 block discarded – undo
496 489
 
497 490
 
498 491
             ProcessFFMpeg::dispatch($queueId, $id, $this->name, $class, $serializedClass);
499
-        }
500
-        else {
492
+        } else {
501 493
             throw new HttpResponseException(redirect(URL::previous())->withErrors([
502 494
                 'ffmpeg_queue_max_num' => trans('larupload::messages.max-queue-num-exceeded')
503 495
             ]));
@@ -531,8 +523,7 @@  discard block
 block discarded – undo
531 523
             foreach ($this->output as $key => $value) {
532 524
                 $model->{"{$this->name}_file_$key"} = $value;
533 525
             }
534
-        }
535
-        else {
526
+        } else {
536 527
             $model->{"{$this->name}_file_name"} = $this->output['name'] ?? null;
537 528
             $model->{"{$this->name}_file_meta"} = json_encode($this->output);
538 529
         }
@@ -564,8 +555,7 @@  discard block
 block discarded – undo
564 555
                 }
565 556
 
566 557
                 return null;
567
-            }
568
-            else if ($name and $this->styleHasFile($style)) {
558
+            } else if ($name and $this->styleHasFile($style)) {
569 559
                 $name = $this->fixExceptionNames($name, $style);
570 560
                 $path = $this->getBasePath($this->id, $style);
571 561
 
Please login to merge, or discard this patch.
src/Storage/FFMpeg.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -142,13 +142,11 @@  discard block
 block discarded – undo
142 142
                     if ($rotate == 90 or $rotate == 270) {
143 143
                         list($meta['height'], $meta['width']) = array($meta['width'], $meta['height']);
144 144
                     }
145
-                }
146
-                else {
145
+                } else {
147 146
                     $process->addErrorOutput('ffprobe output is null');
148 147
                     throw new Exception($process->getErrorOutput());
149 148
                 }
150
-            }
151
-            else {
149
+            } else {
152 150
                 throw new Exception($process->getErrorOutput());
153 151
             }
154 152
 
@@ -187,12 +185,10 @@  discard block
 block discarded – undo
187 185
         if ($mode == LaruploadEnum::CROP_STYLE_MODE) {
188 186
             if ($width and $height) {
189 187
                 $cmd = escapeshellcmd("$this->ffmpeg -ss $fromSecond -i $path -vframes 1 -filter scale=$scaleType,crop=$width:$height");
190
-            }
191
-            else {
188
+            } else {
192 189
                 $cmd = escapeshellcmd("$this->ffmpeg -ss $fromSecond -i $path -vframes 1 -filter scale=$scaleType,crop=$scale:$scale");
193 190
             }
194
-        }
195
-        else {
191
+        } else {
196 192
             $cmd = escapeshellcmd("$this->ffmpeg -ss $fromSecond -i $path -vframes 1 -filter scale=$scaleType");
197 193
         }
198 194
 
@@ -218,12 +214,10 @@  discard block
 block discarded – undo
218 214
         if ($mode == LaruploadEnum::CROP_STYLE_MODE) {
219 215
             if ($scale) {
220 216
                 $cmd = escapeshellcmd("$this->ffmpeg -i $path -vf scale=$scale,crop=$width:$height,setsar=1");
221
-            }
222
-            else {
217
+            } else {
223 218
                 $cmd = escapeshellcmd("$this->ffmpeg -i $path -vf crop=$width:$height,setsar=1");
224 219
             }
225
-        }
226
-        else {
220
+        } else {
227 221
             $cmd = escapeshellcmd("$this->ffmpeg -i $path -vf scale=$scale,setsar=1");
228 222
         }
229 223
 
@@ -317,8 +311,7 @@  discard block
 block discarded – undo
317 311
                     }
318 312
 
319 313
                     $scale = "$scale:-2";
320
-                }
321
-                else {
314
+                } else {
322 315
                     $scale = ceil(($meta['height'] * $width) / $meta['width']);
323 316
 
324 317
                     if ($scale < $height) {
@@ -327,12 +320,10 @@  discard block
 block discarded – undo
327 320
 
328 321
                     $scale = "-2:$scale";
329 322
                 }
330
-            }
331
-            else {
323
+            } else {
332 324
                 $scale = '';
333 325
             }
334
-        }
335
-        else {
326
+        } else {
336 327
             $scale = $width ? "$width:-2" : ($height ? "-2:$height" : (self::DEFAULT_SCALE . ':-2'));
337 328
         }
338 329
 
@@ -366,8 +357,7 @@  discard block
 block discarded – undo
366 357
             }
367 358
 
368 359
             throw new Exception($process->getErrorOutput());
369
-        }
370
-        else {
360
+        } else {
371 361
             list($path, $name) = $this->splitPath($saveTo);
372 362
 
373 363
             $tempDir = $this->tempDir();
@@ -418,8 +408,7 @@  discard block
 block discarded – undo
418 408
             }
419 409
 
420 410
             throw new Exception($process->getErrorOutput());
421
-        }
422
-        else {
411
+        } else {
423 412
             $name = basename($streamPath);
424 413
             $temp = $name . '-' . time();
425 414
 
Please login to merge, or discard this patch.
src/Storage/Image.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -117,8 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
         if ($this->driverIsLocal) {
119 119
             $this->$method($image, $width, $height)->save($saveTo);
120
-        }
121
-        else {
120
+        } else {
122 121
             list($path, $name) = $this->splitPath($saveTo);
123 122
 
124 123
             $tempDir = $this->tempDir();
@@ -361,8 +360,7 @@  discard block
 block discarded – undo
361 360
 
362 361
             if ($file instanceof UploadedFile) {
363 362
                 $path = $file->getRealPath();
364
-            }
365
-            else if (file_exists($file)) {
363
+            } else if (file_exists($file)) {
366 364
                 $path = $file;
367 365
             }
368 366
 
@@ -372,8 +370,7 @@  discard block
 block discarded – undo
372 370
                     return self::toHexString($color);
373 371
                 }
374 372
             }
375
-        }
376
-        catch (Exception) {
373
+        } catch (Exception) {
377 374
             // do nothing
378 375
         }
379 376
 
Please login to merge, or discard this patch.
src/Helpers/Validator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,17 +84,17 @@
 block discarded – undo
84 84
      * @param int|string $videoBitrate
85 85
      * @throws Exception
86 86
      */
87
-    public static function streamIsValid(int|string $audioBitrate, int|string $videoBitrate): void
87
+    public static function streamIsValid(int | string $audioBitrate, int | string $videoBitrate): void
88 88
     {
89 89
         if (ctype_alnum($name) === false) {
90 90
             throw new Exception('stream name [' . $name . '] should be an alpha numeric string');
91 91
         }
92 92
 
93
-        if($width <= 0) {
93
+        if ($width <= 0) {
94 94
             throw new Exception('width [' . $width . '] should be a positive number');
95 95
         }
96 96
 
97
-        if($height <= 0) {
97
+        if ($height <= 0) {
98 98
             throw new Exception('height [' . $height . '] should be a positive number');
99 99
         }
100 100
 
Please login to merge, or discard this patch.
src/Helpers/LaraStandalone.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @throws Exception
34 34
      * @internal
35 35
      */
36
-    public function meta(string $key = null): object|int|string|null
36
+    public function meta(string $key = null): object | int | string | null
37 37
     {
38 38
         if ($this->internalFunctionIsCallable) {
39 39
             return parent::meta($key);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      * @throws Exception
142 142
      * @internal
143 143
      */
144
-    public function download(string $style = 'original'): StreamedResponse|RedirectResponse|null
144
+    public function download(string $style = 'original'): StreamedResponse | RedirectResponse | null
145 145
     {
146 146
         self::internalException();
147 147
     }
Please login to merge, or discard this patch.
src/Helpers/LaraTools.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,17 +34,13 @@  discard block
 block discarded – undo
34 34
     {
35 35
         if (str_contains($mime, 'image/')) {
36 36
             return LaruploadEnum::IMAGE;
37
-        }
38
-        else if (str_contains($mime, 'video/')) {
37
+        } else if (str_contains($mime, 'video/')) {
39 38
             return LaruploadEnum::VIDEO;
40
-        }
41
-        else if (str_contains($mime, 'audio/')) {
39
+        } else if (str_contains($mime, 'audio/')) {
42 40
             return LaruploadEnum::AUDIO;
43
-        }
44
-        else if ($mime == 'application/pdf') {
41
+        } else if ($mime == 'application/pdf') {
45 42
             return LaruploadEnum::PDF;
46
-        }
47
-        else if ($mime == 'application/zip' or $mime == 'application/x-rar-compressed') {
43
+        } else if ($mime == 'application/zip' or $mime == 'application/x-rar-compressed') {
48 44
             return LaruploadEnum::COMPRESSED;
49 45
         }
50 46
 
@@ -92,11 +88,9 @@  discard block
 block discarded – undo
92 88
     {
93 89
         if (ini_get('upload_tmp_dir')) {
94 90
             $path = ini_get('upload_tmp_dir');
95
-        }
96
-        else if (getenv('temp')) {
91
+        } else if (getenv('temp')) {
97 92
             $path = getenv('temp');
98
-        }
99
-        else {
93
+        } else {
100 94
             $path = sys_get_temp_dir();
101 95
         }
102 96
 
Please login to merge, or discard this patch.
src/UploadEntities.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
      * @return $this
497 497
      * @throws Exception
498 498
      */
499
-    public function stream(string $name, int $width, int $height, int|string $audioBitrate, int|string $videoBitrate): UploadEntities
499
+    public function stream(string $name, int $width, int $height, int | string $audioBitrate, int | string $videoBitrate): UploadEntities
500 500
     {
501 501
         Validator::streamIsValid($audioBitrate, $videoBitrate);
502 502
 
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
         $unit = substr($number, -1);
601 601
 
602 602
         if (!array_key_exists($unit, $units)) {
603
-            return (int)$number;
603
+            return (int) $number;
604 604
         }
605 605
 
606
-        $number = (float)$number * $units[$unit];
606
+        $number = (float) $number * $units[$unit];
607 607
 
608
-        return (int)$number;
608
+        return (int) $number;
609 609
     }
610 610
 
611 611
     /**
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
      * @param string $path
687 687
      * @return RedirectResponse|StreamedResponse|Redirector|null
688 688
      */
689
-    protected function storageDownload(string $path): StreamedResponse|RedirectResponse|null
689
+    protected function storageDownload(string $path): StreamedResponse | RedirectResponse | null
690 690
     {
691 691
         if (isset($this->file) and $this->file == LARUPLOAD_NULL) {
692 692
             return null;
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
      */
732 732
     protected function outputToObject(): object
733 733
     {
734
-        $output = (object)$this->output;
734
+        $output = (object) $this->output;
735 735
 
736 736
         if ($this->camelCaseResponse) {
737 737
             $output->mimeType = $output->mime_type;
Please login to merge, or discard this patch.
src/Database/Schema/Blueprint.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
30 30
             $table->string("{$name}_file_dominant_color", 7)->nullable();
31 31
             $table->string("{$name}_file_format", 85)->nullable();
32 32
             $table->string("{$name}_file_cover", 85)->nullable();
33
-        }
34
-        else {
33
+        } else {
35 34
             $table->{self::jsonColumnType()}("{$name}_file_meta")->nullable();
36 35
         }
37 36
     }
Please login to merge, or discard this patch.