Passed
Push — master ( 2d40fa...9e2e38 )
by Darko
10:19
created
app/Extensions/helper/helpers.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use Symfony\Component\Process\Process;
16 16
 use Zip as ZipStream;
17 17
 
18
-if (! function_exists('getRawHtml')) {
18
+if (!function_exists('getRawHtml')) {
19 19
     /**
20 20
      * @param  bool  $cookie
21 21
      * @return bool|mixed|string
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     }
51 51
 }
52 52
 
53
-if (! function_exists('makeFieldLinks')) {
53
+if (!function_exists('makeFieldLinks')) {
54 54
     /**
55 55
      * @return string
56 56
      *
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     }
81 81
 }
82 82
 
83
-if (! function_exists('getUserBrowseOrder')) {
83
+if (!function_exists('getUserBrowseOrder')) {
84 84
     /**
85 85
      * @param  string  $orderBy
86 86
      */
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     }
107 107
 }
108 108
 
109
-if (! function_exists('getUserBrowseOrdering')) {
109
+if (!function_exists('getUserBrowseOrdering')) {
110 110
     function getUserBrowseOrdering(): array
111 111
     {
112 112
         return [
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     }
137 137
 }
138 138
 
139
-if (! function_exists('getSimilarName')) {
139
+if (!function_exists('getSimilarName')) {
140 140
     /**
141 141
      * @param  string  $name
142 142
      */
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     }
147 147
 }
148 148
 
149
-if (! function_exists('human_filesize')) {
149
+if (!function_exists('human_filesize')) {
150 150
     /**
151 151
      * @param  int  $decimals
152 152
      */
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     }
160 160
 }
161 161
 
162
-if (! function_exists('bcdechex')) {
162
+if (!function_exists('bcdechex')) {
163 163
     /**
164 164
      * @return string
165 165
      */
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-if (! function_exists('runCmd')) {
179
+if (!function_exists('runCmd')) {
180 180
     /**
181 181
      * Run CLI command.
182 182
      *
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     }
205 205
 }
206 206
 
207
-if (! function_exists('escapeString')) {
207
+if (!function_exists('escapeString')) {
208 208
 
209 209
     function escapeString($string): string
210 210
     {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     }
213 213
 }
214 214
 
215
-if (! function_exists('realDuration')) {
215
+if (!function_exists('realDuration')) {
216 216
 
217 217
     function realDuration($milliseconds): string
218 218
     {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     }
223 223
 }
224 224
 
225
-if (! function_exists('is_it_json')) {
225
+if (!function_exists('is_it_json')) {
226 226
     /**
227 227
      * @throws JsonException
228 228
      */
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     }
238 238
 }
239 239
 
240
-if (! function_exists('getStreamingZip')) {
240
+if (!function_exists('getStreamingZip')) {
241 241
     /**
242 242
      * @throws Exception
243 243
      */
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     }
265 265
 }
266 266
 
267
-if (! function_exists('release_flag')) {
267
+if (!function_exists('release_flag')) {
268 268
     // Function inspired by c0r3@newznabforums adds country flags on the browse page.
269 269
     /**
270 270
      * @param  string  $text  Text to match against.
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
     }
402 402
 }
403 403
 
404
-if (! function_exists('getReleaseCover')) {
404
+if (!function_exists('getReleaseCover')) {
405 405
     /**
406 406
      * Get the cover image URL for a release based on its type and ID
407 407
      *
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         $coverId = null;
415 415
 
416 416
         // Helper function to get value from object or array
417
-        $getValue = function ($data, $key) {
417
+        $getValue = function($data, $key) {
418 418
             if (is_array($data)) {
419 419
                 return $data[$key] ?? null;
420 420
             } elseif (is_object($data)) {
@@ -433,25 +433,25 @@  discard block
 block discarded – undo
433 433
         $xxxinfo_id = $getValue($release, 'xxxinfo_id');
434 434
         $anidbid = $getValue($release, 'anidbid');
435 435
 
436
-        if (! empty($imdbid) && $imdbid > 0) {
436
+        if (!empty($imdbid) && $imdbid > 0) {
437 437
             $coverType = 'movies';
438 438
             $coverId = str_pad($imdbid, 7, '0', STR_PAD_LEFT);
439
-        } elseif (! empty($musicinfo_id)) {
439
+        } elseif (!empty($musicinfo_id)) {
440 440
             $coverType = 'music';
441 441
             $coverId = $musicinfo_id;
442
-        } elseif (! empty($consoleinfo_id)) {
442
+        } elseif (!empty($consoleinfo_id)) {
443 443
             $coverType = 'console';
444 444
             $coverId = $consoleinfo_id;
445
-        } elseif (! empty($bookinfo_id)) {
445
+        } elseif (!empty($bookinfo_id)) {
446 446
             $coverType = 'book';
447 447
             $coverId = $bookinfo_id;
448
-        } elseif (! empty($gamesinfo_id)) {
448
+        } elseif (!empty($gamesinfo_id)) {
449 449
             $coverType = 'games';
450 450
             $coverId = $gamesinfo_id;
451
-        } elseif (! empty($xxxinfo_id)) {
451
+        } elseif (!empty($xxxinfo_id)) {
452 452
             $coverType = 'xxx';
453 453
             $coverId = $xxxinfo_id;
454
-        } elseif (! empty($anidbid)) {
454
+        } elseif (!empty($anidbid)) {
455 455
             $coverType = 'anime';
456 456
             $coverId = $anidbid;
457 457
         }
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
     }
468 468
 }
469 469
 
470
-if (! function_exists('sanitize')) {
470
+if (!function_exists('sanitize')) {
471 471
     function sanitize(array|string $phrases, array $doNotSanitize = []): string
472 472
     {
473
-        if (! is_array($phrases)) {
473
+        if (!is_array($phrases)) {
474 474
             $wordArray = explode(' ', str_replace('.', ' ', $phrases));
475 475
         } else {
476 476
             $wordArray = $phrases;
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
         foreach ($wordArray as $words) {
482 482
             $words = preg_split('/\s+/', $words);
483 483
             foreach ($words as $st) {
484
-                if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
484
+                if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
485 485
                     $str = $st;
486
-                } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
486
+                } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
487 487
                     $str = $st;
488 488
                 } else {
489 489
                     $str = Sanitizer::escape($st, $doNotSanitize);
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     }
499 499
 }
500 500
 
501
-if (! function_exists('formatBytes')) {
501
+if (!function_exists('formatBytes')) {
502 502
     /**
503 503
      * Format bytes into human-readable file size.
504 504
      *
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
     }
518 518
 }
519 519
 
520
-if (! function_exists('csp_nonce')) {
520
+if (!function_exists('csp_nonce')) {
521 521
     /**
522 522
      * Generate a CSP nonce for inline scripts
523 523
      * This should be stored in the request and reused across the request lifecycle
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     }
535 535
 }
536 536
 
537
-if (! function_exists('userDate')) {
537
+if (!function_exists('userDate')) {
538 538
     /**
539 539
      * Format a date/time string according to the authenticated user's timezone
540 540
      *
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     }
567 567
 }
568 568
 
569
-if (! function_exists('userDateDiffForHumans')) {
569
+if (!function_exists('userDateDiffForHumans')) {
570 570
     /**
571 571
      * Format a date/time string as a human-readable diff according to the authenticated user's timezone
572 572
      *
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     }
598 598
 }
599 599
 
600
-if (! function_exists('getAvailableTimezones')) {
600
+if (!function_exists('getAvailableTimezones')) {
601 601
     /**
602 602
      * Get a list of available timezones grouped by region
603 603
      *
Please login to merge, or discard this patch.