Passed
Push — master ( 90fb01...efec1e )
by Darko
12:10 queued 01:32
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
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     }
107 107
 }
108 108
 
109
-if (! function_exists('makeFieldLinks')) {
109
+if (!function_exists('makeFieldLinks')) {
110 110
     /**
111 111
      * @return string
112 112
      *
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     }
137 137
 }
138 138
 
139
-if (! function_exists('getUserBrowseOrder')) {
139
+if (!function_exists('getUserBrowseOrder')) {
140 140
     /**
141 141
      * @param  string  $orderBy
142 142
      */
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     }
163 163
 }
164 164
 
165
-if (! function_exists('getUserBrowseOrdering')) {
165
+if (!function_exists('getUserBrowseOrdering')) {
166 166
     function getUserBrowseOrdering(): array
167 167
     {
168 168
         return [
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     }
193 193
 }
194 194
 
195
-if (! function_exists('getSimilarName')) {
195
+if (!function_exists('getSimilarName')) {
196 196
     /**
197 197
      * @param  string  $name
198 198
      */
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     }
203 203
 }
204 204
 
205
-if (! function_exists('human_filesize')) {
205
+if (!function_exists('human_filesize')) {
206 206
     /**
207 207
      * @param  int  $decimals
208 208
      */
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     }
216 216
 }
217 217
 
218
-if (! function_exists('bcdechex')) {
218
+if (!function_exists('bcdechex')) {
219 219
     /**
220 220
      * @return string
221 221
      */
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     }
233 233
 }
234 234
 
235
-if (! function_exists('runCmd')) {
235
+if (!function_exists('runCmd')) {
236 236
     /**
237 237
      * Run CLI command.
238 238
      *
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     }
261 261
 }
262 262
 
263
-if (! function_exists('escapeString')) {
263
+if (!function_exists('escapeString')) {
264 264
 
265 265
     function escapeString($string): string
266 266
     {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     }
269 269
 }
270 270
 
271
-if (! function_exists('realDuration')) {
271
+if (!function_exists('realDuration')) {
272 272
 
273 273
     function realDuration($milliseconds): string
274 274
     {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     }
279 279
 }
280 280
 
281
-if (! function_exists('is_it_json')) {
281
+if (!function_exists('is_it_json')) {
282 282
     /**
283 283
      * @throws JsonException
284 284
      */
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     }
294 294
 }
295 295
 
296
-if (! function_exists('getStreamingZip')) {
296
+if (!function_exists('getStreamingZip')) {
297 297
     /**
298 298
      * @throws Exception
299 299
      */
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
 }
322 322
 
323
-if (! function_exists('release_flag')) {
323
+if (!function_exists('release_flag')) {
324 324
     // Function inspired by c0r3@newznabforums adds country flags on the browse page.
325 325
     /**
326 326
      * @param  string  $text  Text to match against.
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
     }
458 458
 }
459 459
 
460
-if (! function_exists('getReleaseCover')) {
460
+if (!function_exists('getReleaseCover')) {
461 461
     /**
462 462
      * Get the cover image URL for a release based on its type and ID
463 463
      *
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
         $coverId = null;
471 471
 
472 472
         // Helper function to get value from object or array
473
-        $getValue = function ($data, $key) {
473
+        $getValue = function($data, $key) {
474 474
             if (is_array($data)) {
475 475
                 return $data[$key] ?? null;
476 476
             } elseif (is_object($data)) {
@@ -489,25 +489,25 @@  discard block
 block discarded – undo
489 489
         $xxxinfo_id = $getValue($release, 'xxxinfo_id');
490 490
         $anidbid = $getValue($release, 'anidbid');
491 491
 
492
-        if (! empty($imdbid) && $imdbid > 0) {
492
+        if (!empty($imdbid) && $imdbid > 0) {
493 493
             $coverType = 'movies';
494 494
             $coverId = str_pad($imdbid, 7, '0', STR_PAD_LEFT);
495
-        } elseif (! empty($musicinfo_id)) {
495
+        } elseif (!empty($musicinfo_id)) {
496 496
             $coverType = 'music';
497 497
             $coverId = $musicinfo_id;
498
-        } elseif (! empty($consoleinfo_id)) {
498
+        } elseif (!empty($consoleinfo_id)) {
499 499
             $coverType = 'console';
500 500
             $coverId = $consoleinfo_id;
501
-        } elseif (! empty($bookinfo_id)) {
501
+        } elseif (!empty($bookinfo_id)) {
502 502
             $coverType = 'book';
503 503
             $coverId = $bookinfo_id;
504
-        } elseif (! empty($gamesinfo_id)) {
504
+        } elseif (!empty($gamesinfo_id)) {
505 505
             $coverType = 'games';
506 506
             $coverId = $gamesinfo_id;
507
-        } elseif (! empty($xxxinfo_id)) {
507
+        } elseif (!empty($xxxinfo_id)) {
508 508
             $coverType = 'xxx';
509 509
             $coverId = $xxxinfo_id;
510
-        } elseif (! empty($anidbid) && $anidbid > 0) {
510
+        } elseif (!empty($anidbid) && $anidbid > 0) {
511 511
             $coverType = 'anime';
512 512
             $coverId = $anidbid;
513 513
         }
@@ -523,10 +523,10 @@  discard block
 block discarded – undo
523 523
     }
524 524
 }
525 525
 
526
-if (! function_exists('sanitize')) {
526
+if (!function_exists('sanitize')) {
527 527
     function sanitize(array|string $phrases, array $doNotSanitize = []): string
528 528
     {
529
-        if (! is_array($phrases)) {
529
+        if (!is_array($phrases)) {
530 530
             $wordArray = explode(' ', str_replace('.', ' ', $phrases));
531 531
         } else {
532 532
             $wordArray = $phrases;
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
         foreach ($wordArray as $words) {
538 538
             $words = preg_split('/\s+/', $words);
539 539
             foreach ($words as $st) {
540
-                if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
540
+                if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
541 541
                     $str = $st;
542
-                } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
542
+                } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
543 543
                     $str = $st;
544 544
                 } else {
545 545
                     $str = Sanitizer::escape($st, $doNotSanitize);
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
     }
555 555
 }
556 556
 
557
-if (! function_exists('formatBytes')) {
557
+if (!function_exists('formatBytes')) {
558 558
     /**
559 559
      * Format bytes into human-readable file size.
560 560
      *
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
     }
574 574
 }
575 575
 
576
-if (! function_exists('csp_nonce')) {
576
+if (!function_exists('csp_nonce')) {
577 577
     /**
578 578
      * Generate a CSP nonce for inline scripts
579 579
      * This should be stored in the request and reused across the request lifecycle
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     }
591 591
 }
592 592
 
593
-if (! function_exists('userDate')) {
593
+if (!function_exists('userDate')) {
594 594
     /**
595 595
      * Format a date/time string according to the authenticated user's timezone
596 596
      *
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
     }
623 623
 }
624 624
 
625
-if (! function_exists('userDateDiffForHumans')) {
625
+if (!function_exists('userDateDiffForHumans')) {
626 626
     /**
627 627
      * Format a date/time string as a human-readable diff according to the authenticated user's timezone
628 628
      *
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     }
654 654
 }
655 655
 
656
-if (! function_exists('getAvailableTimezones')) {
656
+if (!function_exists('getAvailableTimezones')) {
657 657
     /**
658 658
      * Get a list of available timezones grouped by region
659 659
      *
Please login to merge, or discard this patch.