Passed
Pull Request — master (#1500)
by
unknown
10:36 queued 04:52
created
Blacklight/processing/ProcessReleases.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $this->echoCLI = config('nntmux.echocli');
111 111
         $groupID = '';
112 112
 
113
-        if (! empty($groupName)) {
113
+        if (!empty($groupName)) {
114 114
             $groupInfo = UsenetGroup::getByName($groupName);
115 115
             if ($groupInfo !== null) {
116 116
                 $groupID = $groupInfo['id'];
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             $this->colorCLI->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')');
122 122
         }
123 123
 
124
-        if (! file_exists(Settings::settingValue('..nzbpath'))) {
124
+        if (!file_exists(Settings::settingValue('..nzbpath'))) {
125 125
             if ($this->echoCLI) {
126 126
                 $this->colorCLI->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath'));
127 127
             }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         $cat = new Categorize();
183 183
         $categorized = $total = 0;
184 184
         $releasesQuery = Release::query()->where(['categories_id' => Category::OTHER_MISC, 'iscategorized' => 0]);
185
-        if (! empty($groupId)) {
185
+        if (!empty($groupId)) {
186 186
             $releasesQuery->where('groups_id', $groupId);
187 187
         }
188 188
         $releases = $releasesQuery->select(['id', 'fromname', 'groups_id', $type])->get();
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             $this->colorCLI->header('Process Releases -> Attempting to find complete collections.');
219 219
         }
220 220
 
221
-        $where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' ');
221
+        $where = (!empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' ');
222 222
 
223 223
         $this->processStuckCollections($groupID);
224 224
         $this->collectionFileCheckStage1($groupID);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         if ($this->echoCLI) {
232 232
             $countQuery = Collection::query()->where('filecheck', self::COLLFC_COMPPART);
233 233
 
234
-            if (! empty($groupID)) {
234
+            if (!empty($groupID)) {
235 235
                 $countQuery->where('groups_id', $groupID);
236 236
             }
237 237
             $count = $countQuery->count('id');
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
             $this->colorCLI->header('Process Releases -> Calculating collection sizes (in bytes).');
259 259
         }
260 260
         // Get the total size in bytes of the collection for collections where filecheck = 2.
261
-        DB::transaction(function () use ($groupID, $startTime) {
261
+        DB::transaction(function() use ($groupID, $startTime) {
262 262
             $checked = DB::update(
263 263
                 sprintf(
264 264
                     '
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				AND c.filesize = 0 %s',
275 275
                     self::COLLFC_SIZED,
276 276
                     self::COLLFC_COMPPART,
277
-                    (! empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ')
277
+                    (!empty($groupID) ? ' AND c.groups_id = '.$groupID : ' ')
278 278
                 )
279 279
             );
280 280
             if ($checked > 0 && $this->echoCLI) {
@@ -313,16 +313,16 @@  discard block
 block discarded – undo
313 313
 
314 314
             $groupMinimums = UsenetGroup::getGroupByID($grpID['id']);
315 315
             if ($groupMinimums !== null) {
316
-                if (! empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) {
316
+                if (!empty($groupMinimums['minsizetoformrelease']) && $groupMinimums['minsizetoformrelease'] > 0) {
317 317
                     $groupMinSizeSetting = (int) $groupMinimums['minsizetoformrelease'];
318 318
                 }
319
-                if (! empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) {
319
+                if (!empty($groupMinimums['minfilestoformrelease']) && $groupMinimums['minfilestoformrelease'] > 0) {
320 320
                     $groupMinFilesSetting = (int) $groupMinimums['minfilestoformrelease'];
321 321
                 }
322 322
             }
323 323
 
324 324
             if (Collection::query()->where('filecheck', self::COLLFC_SIZED)->where('filesize', '>', 0)->first() !== null) {
325
-                DB::transaction(function () use (
325
+                DB::transaction(function() use (
326 326
                     $groupMinSizeSetting,
327 327
                     $minSizeSetting,
328 328
                     $minSizeDeleted,
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         $collectionsQuery = Collection::query()
396 396
             ->where('collections.filecheck', self::COLLFC_SIZED)
397 397
             ->where('collections.filesize', '>', 0);
398
-        if (! empty($groupID)) {
398
+        if (!empty($groupID)) {
399 399
             $collectionsQuery->where('collections.groups_id', $groupID);
400 400
         }
401 401
         $collectionsQuery->select(['collections.*', 'usenet_groups.name as gname'])
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                 $releaseID = Release::insertRelease(
451 451
                     [
452 452
                         'name' => $cleanRelName,
453
-                        'searchname' => ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName,
453
+                        'searchname' => !empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName,
454 454
                         'totalpart' => $collection->totalfiles,
455 455
                         'groups_id' => $collection->groups_id,
456 456
                         'guid' => createGUID(),
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
                 if ($releaseID !== null) {
468 468
                     // Update collections table to say we inserted the release.
469
-                    DB::transaction(static function () use ($collection, $releaseID) {
469
+                    DB::transaction(static function() use ($collection, $releaseID) {
470 470
                         Collection::query()->where('id', $collection->id)->update(['filecheck' => self::COLLFC_INSERTED, 'releases_id' => $releaseID]);
471 471
                     }, 10);
472 472
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                 }
528 528
             } else {
529 529
                 // The release was already in the DB, so delete the collection.
530
-                DB::transaction(static function () use ($collection) {
530
+                DB::transaction(static function() use ($collection) {
531 531
                     Collection::query()->where('collectionhash', $collection->collectionhash)->delete();
532 532
                 }, 10);
533 533
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
         }
569 569
 
570 570
         $releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0);
571
-        if (! empty($groupID)) {
571
+        if (!empty($groupID)) {
572 572
             $releasesQuery->where('releases.groups_id', $groupID);
573 573
         }
574 574
         $releases = $releasesQuery->select(['id', 'guid', 'name', 'categories_id'])->get();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
                 ), true);
672 672
         }
673 673
 
674
-        DB::transaction(function () use ($deletedCount, $startTime) {
674
+        DB::transaction(function() use ($deletedCount, $startTime) {
675 675
             $deleted = 0;
676 676
             $deleteQuery = Collection::query()
677 677
                 ->where('dateadded', '<', now()->subHours(Settings::settingValue('..partretentionhours')))
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
             $releases = Release::query()
835 835
                 ->select(['id', 'guid'])
836 836
                 ->where('passwordstatus', '=', Releases::PASSWD_RAR)
837
-                ->orWhereIn('id', function ($query) {
837
+                ->orWhereIn('id', function($query) {
838 838
                     $query->select('releases_id')
839 839
                         ->from('release_files')
840 840
                         ->where('passworded', '=', Releases::PASSWD_RAR);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
             foreach ($genrelist as $genre) {
894 894
                 $musicInfoQuery = MusicInfo::query()->where('genre_id', (int) $genre['id'])->select(['id']);
895 895
                 $releases = Release::query()
896
-                    ->joinSub($musicInfoQuery, 'mi', function ($join) {
896
+                    ->joinSub($musicInfoQuery, 'mi', function($join) {
897 897
                         $join->on('releases.musicinfo_id', '=', 'mi.id');
898 898
                     })
899 899
                     ->select(['releases.id', 'releases.guid'])
@@ -979,18 +979,18 @@  discard block
 block discarded – undo
979 979
      */
980 980
     private function collectionFileCheckStage1(int $groupID): void
981 981
     {
982
-        DB::transaction(static function () use ($groupID) {
982
+        DB::transaction(static function() use ($groupID) {
983 983
             $collectionsCheck = Collection::query()->select(['collections.id'])
984 984
                 ->join('binaries', 'binaries.collections_id', '=', 'collections.id')
985 985
                 ->where('collections.totalfiles', '>', 0)
986 986
                 ->where('collections.filecheck', '=', self::COLLFC_DEFAULT);
987
-            if (! empty($groupID)) {
987
+            if (!empty($groupID)) {
988 988
                 $collectionsCheck->where('collections.groups_id', $groupID);
989 989
             }
990 990
             $collectionsCheck->groupBy('binaries.collections_id', 'collections.totalfiles', 'collections.id')
991 991
                 ->havingRaw('COUNT(binaries.id) IN (collections.totalfiles, collections.totalfiles+1)');
992 992
 
993
-            Collection::query()->joinSub($collectionsCheck, 'r', function ($join) {
993
+            Collection::query()->joinSub($collectionsCheck, 'r', function($join) {
994 994
                 $join->on('collections.id', '=', 'r.id');
995 995
             })->update(['collections.filecheck' => self::COLLFC_COMPCOLL]);
996 996
         }, 10);
@@ -1011,25 +1011,25 @@  discard block
 block discarded – undo
1011 1011
      */
1012 1012
     private function collectionFileCheckStage2(int $groupID): void
1013 1013
     {
1014
-        DB::transaction(static function () use ($groupID) {
1014
+        DB::transaction(static function() use ($groupID) {
1015 1015
             $collectionsCheck = Collection::query()->select(['collections.id'])
1016 1016
                 ->join('binaries', 'binaries.collections_id', '=', 'collections.id')
1017 1017
                 ->where('binaries.filenumber', '=', 0)
1018 1018
                 ->where('collections.totalfiles', '>', 0)
1019 1019
                 ->where('collections.filecheck', '=', self::COLLFC_COMPCOLL);
1020
-            if (! empty($groupID)) {
1020
+            if (!empty($groupID)) {
1021 1021
                 $collectionsCheck->where('collections.groups_id', $groupID);
1022 1022
             }
1023 1023
             $collectionsCheck->groupBy('collections.id');
1024 1024
 
1025
-            Collection::query()->joinSub($collectionsCheck, 'r', function ($join) {
1025
+            Collection::query()->joinSub($collectionsCheck, 'r', function($join) {
1026 1026
                 $join->on('collections.id', '=', 'r.id');
1027 1027
             })->update(['collections.filecheck' => self::COLLFC_ZEROPART]);
1028 1028
         }, 10);
1029 1029
 
1030
-        DB::transaction(static function () use ($groupID) {
1030
+        DB::transaction(static function() use ($groupID) {
1031 1031
             $collectionQuery = Collection::query()->where('filecheck', '=', self::COLLFC_COMPCOLL);
1032
-            if (! empty($groupID)) {
1032
+            if (!empty($groupID)) {
1033 1033
                 $collectionQuery->where('groups_id', $groupID);
1034 1034
             }
1035 1035
             $collectionQuery->update(['filecheck' => self::COLLFC_TEMPCOMP]);
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
      */
1048 1048
     private function collectionFileCheckStage3(string $where): void
1049 1049
     {
1050
-        DB::transaction(static function () use ($where) {
1050
+        DB::transaction(static function() use ($where) {
1051 1051
             DB::update(
1052 1052
                 sprintf(
1053 1053
                     '
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
             );
1072 1072
         }, 10);
1073 1073
 
1074
-        DB::transaction(static function () use ($where) {
1074
+        DB::transaction(static function() use ($where) {
1075 1075
             DB::update(
1076 1076
                 sprintf(
1077 1077
                     '
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
      */
1109 1109
     private function collectionFileCheckStage4(string &$where): void
1110 1110
     {
1111
-        DB::transaction(static function () use ($where) {
1111
+        DB::transaction(static function() use ($where) {
1112 1112
             DB::update(
1113 1113
                 sprintf(
1114 1114
                     '
@@ -1138,9 +1138,9 @@  discard block
 block discarded – undo
1138 1138
      */
1139 1139
     private function collectionFileCheckStage5(int $groupId): void
1140 1140
     {
1141
-        DB::transaction(static function () use ($groupId) {
1141
+        DB::transaction(static function() use ($groupId) {
1142 1142
             $collectionQuery = Collection::query()->whereIn('filecheck', [self::COLLFC_TEMPCOMP, self::COLLFC_ZEROPART]);
1143
-            if (! empty($groupId)) {
1143
+            if (!empty($groupId)) {
1144 1144
                 $collectionQuery->where('groups_id', $groupId);
1145 1145
             }
1146 1146
             $collectionQuery->update(['filecheck' => self::COLLFC_COMPCOLL]);
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
      */
1159 1159
     private function collectionFileCheckStage6(string &$where): void
1160 1160
     {
1161
-        DB::transaction(function () use ($where) {
1161
+        DB::transaction(function() use ($where) {
1162 1162
             DB::update(
1163 1163
                 sprintf(
1164 1164
                     "
@@ -1188,10 +1188,10 @@  discard block
 block discarded – undo
1188 1188
     {
1189 1189
         $lastRun = Settings::settingValue('indexer.processing.last_run_time');
1190 1190
 
1191
-        DB::transaction(function () use ($groupID, $lastRun) {
1191
+        DB::transaction(function() use ($groupID, $lastRun) {
1192 1192
             $objQuery = Collection::query()
1193 1193
                 ->where('added', '<', Carbon::createFromFormat('Y-m-d H:i:s', $lastRun)->subHours($this->collectionTimeout));
1194
-            if (! empty($groupID)) {
1194
+            if (!empty($groupID)) {
1195 1195
                 $objQuery->where('groups_id', $groupID);
1196 1196
             }
1197 1197
             $obj = $objQuery->delete();
Please login to merge, or discard this patch.
app/Console/Commands/CleanNZB.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function handle()
38 38
     {
39 39
         // Check if any options are false
40
-        if (! $this->option('notindb') && ! $this->option('notondisk')) {
40
+        if (!$this->option('notindb') && !$this->option('notondisk')) {
41 41
             $this->error('You must specify at least one option. See: --help');
42 42
             exit();
43 43
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $guid = stristr($filePath->getFilename(), '.nzb.gz', true);
64 64
             if (File::isFile($filePath) && $guid) {
65 65
                 // If NZB file guid is not present in DB delete the file from disk
66
-                if (! $releases->whereGuid($guid)->exists()) {
66
+                if (!$releases->whereGuid($guid)->exists()) {
67 67
                     if ($delete) {
68 68
                         File::delete($filePath);
69 69
                     }
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
         $total = Release::count();
89 89
         $this->alert("Total releases to check: $total");
90 90
 
91
-        Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function (Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) {
91
+        Release::where('nzbstatus', 1)->chunkById((int) $this->option('chunksize'), function(Collection $releases) use ($delete, &$checked, &$deleted, $nzb, $rel) {
92 92
             echo 'Total done: '.$checked."\r";
93 93
             foreach ($releases as $r) {
94 94
 
95
-                if (! $nzb->NZBPath($r->guid)) {
95
+                if (!$nzb->NZBPath($r->guid)) {
96 96
                     if ($delete) {
97 97
                         $rel->deleteSingle(['g' => $r->guid, 'i' => $r->id], $nzb, new ReleaseImage());
98 98
                     }
Please login to merge, or discard this patch.
app/Providers/AppServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         Paginator::useBootstrapFive();
18 18
         $smarty = app('smarty.view');
19 19
         view()->share('smarty', $smarty);
20
-        Gate::define('viewPulse', function (User $user) {
20
+        Gate::define('viewPulse', function(User $user) {
21 21
             return $user->hasRole('Admin');
22 22
         });
23 23
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ForgotPasswordController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         if (empty($email) && empty($rssToken)) {
47 47
             app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset');
48 48
         } else {
49
-            if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
49
+            if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) {
50 50
                 $this->validate($request, [
51 51
                     'g-recaptcha-response' => 'required|captcha',
52 52
                 ]);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             //
55 55
             // Check users exists and send an email
56 56
             //
57
-            $ret = ! empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email);
57
+            $ret = !empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email);
58 58
             if ($ret === null) {
59 59
                 app('smarty.view')->assign('error', 'The email or apikey are not recognised.');
60 60
                 $sent = true;
Please login to merge, or discard this patch.
routes/web.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
 Route::post('login', [LoginController::class, 'login'])->name('login');
88 88
 Route::get('logout', [LoginController::class, 'logout'])->name('logout');
89 89
 
90
-Route::middleware('isVerified')->group(function () {
90
+Route::middleware('isVerified')->group(function() {
91 91
     Route::get('resetpassword', [ResetPasswordController::class, 'reset']);
92 92
     Route::post('resetpassword', [ResetPasswordController::class, 'reset']);
93 93
 
94 94
     Route::get('profile', [ProfileController::class, 'show']);
95 95
 
96
-    Route::prefix('browse')->group(function () {
96
+    Route::prefix('browse')->group(function() {
97 97
         Route::get('tags', [BrowseController::class, 'tags']);
98 98
         Route::get('group', [BrowseController::class, 'group']);
99 99
         Route::get('All', [BrowseController::class, 'index']);
100 100
         Route::get('{parentCategory}/{id?}', [BrowseController::class, 'show'])->middleware('clearance');
101 101
     });
102 102
 
103
-    Route::prefix('cart')->group(function () {
103
+    Route::prefix('cart')->group(function() {
104 104
         Route::get('index', [CartController::class, 'index']);
105 105
         Route::post('index', [CartController::class, 'index']);
106 106
         Route::get('add', [CartController::class, 'store']);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
     Route::post('failed', [FailedReleasesController::class, 'failed'])->name('failed');
135 135
 
136
-    Route::middleware('clearance')->group(function () {
136
+    Route::middleware('clearance')->group(function() {
137 137
         Route::get('Games', [GamesController::class, 'show'])->name('Games');
138 138
         Route::post('Games', [GamesController::class, 'show'])->name('Games');
139 139
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 Route::post('forum-delete/{id}', [ForumController::class, 'destroy'])->middleware('role:Admin');
250 250
 
251
-Route::middleware('role:Admin', '2fa')->prefix('admin')->group(function () {
251
+Route::middleware('role:Admin', '2fa')->prefix('admin')->group(function() {
252 252
     Route::get('index', [AdminPageController::class, 'index']);
253 253
     Route::get('anidb-delete/{id}', [AdminAnidbController::class, 'destroy']);
254 254
     Route::post('anidb-delete/{id}', [AdminAnidbController::class, 'destroy']);
@@ -367,16 +367,16 @@  discard block
 block discarded – undo
367 367
     Route::post('group-list-inactive', [AdminGroupController::class, 'inactive']);
368 368
 });
369 369
 
370
-Route::middleware('role_or_permission:Admin|Moderator|edit release')->prefix('admin')->group(function () {
370
+Route::middleware('role_or_permission:Admin|Moderator|edit release')->prefix('admin')->group(function() {
371 371
     Route::get('release-edit', [AdminReleasesController::class, 'edit']);
372 372
     Route::post('release-edit', [AdminReleasesController::class, 'edit']);
373 373
 });
374 374
 
375
-Route::post('2faVerify', function () {
375
+Route::post('2faVerify', function() {
376 376
     return redirect()->to(URL()->previous());
377 377
 })->name('2faVerify')->middleware('2fa');
378 378
 
379
-Route::post('btcpay/webhook', function (Illuminate\Http\Request $request) {
379
+Route::post('btcpay/webhook', function(Illuminate\Http\Request $request) {
380 380
     $hashCheck = 'sha256='.hash_hmac('sha256', $request->getContent(), config('nntmux.btcpay_webhook_secret'));
381 381
     if ($hashCheck !== $request->header('btcpay-sig')) {
382 382
         Log::error('BTCPay webhook hash check failed: '.$request->header('btcpay-sig'));
Please login to merge, or discard this patch.
app/Extensions/helper/helpers.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use Symfony\Component\Process\Process;
17 17
 use Zip as ZipStream;
18 18
 
19
-if (! function_exists('getRawHtml')) {
19
+if (!function_exists('getRawHtml')) {
20 20
     /**
21 21
      * @param  bool  $cookie
22 22
      * @return bool|mixed|string
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     }
52 52
 }
53 53
 
54
-if (! function_exists('makeFieldLinks')) {
54
+if (!function_exists('makeFieldLinks')) {
55 55
     /**
56 56
      * @return string
57 57
      *
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     }
82 82
 }
83 83
 
84
-if (! function_exists('getUserBrowseOrder')) {
84
+if (!function_exists('getUserBrowseOrder')) {
85 85
     /**
86 86
      * @param  string  $orderBy
87 87
      */
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     }
108 108
 }
109 109
 
110
-if (! function_exists('getUserBrowseOrdering')) {
110
+if (!function_exists('getUserBrowseOrdering')) {
111 111
     function getUserBrowseOrdering(): array
112 112
     {
113 113
         return [
@@ -137,21 +137,21 @@  discard block
 block discarded – undo
137 137
     }
138 138
 }
139 139
 
140
-if (! function_exists('createGUID')) {
140
+if (!function_exists('createGUID')) {
141 141
     /**
142 142
      * @throws Exception
143 143
      */
144 144
     function createGUID(): string
145 145
     {
146 146
         $data = random_bytes(16);
147
-        $data[6] = \chr(\ord($data[6]) & 0x0F | 0x40);    // set version to 0100
148
-        $data[8] = \chr(\ord($data[8]) & 0x3F | 0x80);    // set bits 6-7 to 10
147
+        $data[6] = \chr(\ord($data[6]) & 0x0F|0x40); // set version to 0100
148
+        $data[8] = \chr(\ord($data[8]) & 0x3F|0x80); // set bits 6-7 to 10
149 149
 
150 150
         return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(sodium_bin2hex($data), 4));
151 151
     }
152 152
 }
153 153
 
154
-if (! function_exists('getSimilarName')) {
154
+if (!function_exists('getSimilarName')) {
155 155
     /**
156 156
      * @param  string  $name
157 157
      */
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     }
162 162
 }
163 163
 
164
-if (! function_exists('color')) {
164
+if (!function_exists('color')) {
165 165
     /**
166 166
      * @param  string  $string
167 167
      */
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     }
172 172
 }
173 173
 
174
-if (! function_exists('human_filesize')) {
174
+if (!function_exists('human_filesize')) {
175 175
     /**
176 176
      * @param  int  $decimals
177 177
      */
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     }
185 185
 }
186 186
 
187
-if (! function_exists('bcdechex')) {
187
+if (!function_exists('bcdechex')) {
188 188
     /**
189 189
      * @return string
190 190
      */
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     }
202 202
 }
203 203
 
204
-if (! function_exists('runCmd')) {
204
+if (!function_exists('runCmd')) {
205 205
     /**
206 206
      * Run CLI command.
207 207
      *
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     }
230 230
 }
231 231
 
232
-if (! function_exists('escapeString')) {
232
+if (!function_exists('escapeString')) {
233 233
     /**
234 234
      * @return string
235 235
      */
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     }
240 240
 }
241 241
 
242
-if (! function_exists('realDuration')) {
242
+if (!function_exists('realDuration')) {
243 243
     /**
244 244
      * @return string
245 245
      */
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     }
252 252
 }
253 253
 
254
-if (! function_exists('is_it_json')) {
254
+if (!function_exists('is_it_json')) {
255 255
     /**
256 256
      * @param  array|string  $isIt
257 257
      * @return bool
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     return $zipped;
295 295
 }
296 296
 
297
-if (! function_exists('release_flag')) {
297
+if (!function_exists('release_flag')) {
298 298
     // Function inspired by c0r3@newznabforums adds country flags on the browse page.
299 299
     /**
300 300
      * @param  string  $text  Text to match against.
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
 
431 431
         return '';
432 432
     }
433
-    if (! function_exists('sanitize')) {
433
+    if (!function_exists('sanitize')) {
434 434
         function sanitize(array|string $phrases, array $doNotSanitize = []): string
435 435
         {
436
-            if (! is_array($phrases)) {
436
+            if (!is_array($phrases)) {
437 437
                 $wordArray = explode(' ', str_replace('.', ' ', $phrases));
438 438
             } else {
439 439
                 $wordArray = $phrases;
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
             foreach ($wordArray as $words) {
445 445
                 $words = preg_split('/\s+/', $words);
446 446
                 foreach ($words as $st) {
447
-                    if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
447
+                    if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
448 448
                         $str = $st;
449
-                    } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) {
449
+                    } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) {
450 450
                         $str = $st;
451 451
                     } else {
452 452
                         $str = Sanitizer::escape($st, $doNotSanitize);
Please login to merge, or discard this patch.
Blacklight/processing/post/ProcessAdditional.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 
292 292
         // Pass the binary extractors to ArchiveInfo.
293 293
         $clients = [];
294
-        if (! empty(Settings::settingValue('apps..unrarpath'))) {
294
+        if (!empty(Settings::settingValue('apps..unrarpath'))) {
295 295
             $this->_unrarPath = Settings::settingValue('apps..unrarpath');
296 296
             $clients += [ArchiveInfo::TYPE_RAR => $this->_unrarPath];
297 297
         }
298
-        if (! empty(Settings::settingValue('apps..zippath'))) {
298
+        if (!empty(Settings::settingValue('apps..zippath'))) {
299 299
             $this->_7zipPath = Settings::settingValue('apps..zippath');
300 300
             $clients += [ArchiveInfo::TYPE_SZIP => $this->_7zipPath];
301 301
             $clients += [ArchiveInfo::TYPE_ZIP => $this->_7zipPath];
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         $this->_archiveInfo->setExternalClients($clients);
304 304
 
305 305
         $this->_killString = '"';
306
-        if (! empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) {
306
+        if (!empty(Settings::settingValue('apps..timeoutpath')) && (int) Settings::settingValue('..timeoutseconds') > 0) {
307 307
             $this->_killString = (
308 308
                 '"'.Settings::settingValue('apps..timeoutpath').
309 309
                 '" --foreground --signal=KILL '.
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
         $this->_addPAR2Files = (int) Settings::settingValue('..addpar2') !== 0;
345 345
 
346
-        if (! Settings::settingValue('apps..ffmpegpath')) {
346
+        if (!Settings::settingValue('apps..ffmpegpath')) {
347 347
             $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false;
348 348
         } else {
349 349
             $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0;
355 355
         $this->_processMediaInfo = Settings::settingValue('apps..mediainfopath') !== '';
356 356
         $this->_processAudioInfo = $this->_processMediaInfo;
357
-        $this->_processPasswords = ! empty(Settings::settingValue('..checkpasswordedrar')) && ! empty(Settings::settingValue('apps..unrarpath'));
357
+        $this->_processPasswords = !empty(Settings::settingValue('..checkpasswordedrar')) && !empty(Settings::settingValue('apps..unrarpath'));
358 358
 
359 359
         $this->_audioSavePath = storage_path('covers/audiosample/');
360 360
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         $this->_mainTmpPath = (string) Settings::settingValue('..tmpunrarpath');
412 412
 
413 413
         // Check if it ends with a dir separator.
414
-        if (! preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) {
414
+        if (!preg_match('/[\/\\\\]$/', $this->_mainTmpPath)) {
415 415
             $this->_mainTmpPath .= '/';
416 416
         }
417 417
 
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
             $this->_mainTmpPath .= ($guidChar.'/');
423 423
         }
424 424
 
425
-        if (! File::isDirectory($this->_mainTmpPath)) {
426
-            if (! File::makeDirectory($this->_mainTmpPath, 0777, true, true) && ! File::isDirectory($this->_mainTmpPath)) {
425
+        if (!File::isDirectory($this->_mainTmpPath)) {
426
+            if (!File::makeDirectory($this->_mainTmpPath, 0777, true, true) && !File::isDirectory($this->_mainTmpPath)) {
427 427
                 throw new \RuntimeException(sprintf('Directory "%s" was not created', $this->_mainTmpPath));
428 428
             }
429 429
         }
430 430
 
431
-        if (! File::isDirectory($this->_mainTmpPath)) {
431
+        if (!File::isDirectory($this->_mainTmpPath)) {
432 432
             throw new \RuntimeException('Could not create the tmpunrar folder ('.$this->_mainTmpPath.')');
433 433
         }
434 434
 
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
         if ($this->_minSize > 0) {
474 474
             $releasesQuery->where('releases.size', '>', (int) $this->_minSize * 1048576);
475 475
         }
476
-        if (! empty($groupID)) {
476
+        if (!empty($groupID)) {
477 477
             $releasesQuery->where('releases.groups_id', $groupID);
478 478
         }
479
-        if (! empty($guidChar)) {
479
+        if (!empty($guidChar)) {
480 480
             $releasesQuery->where('releases.leftguid', $guidChar);
481 481
         }
482 482
         $releasesQuery->select(['releases.id', 'releases.id as releases_id', 'releases.guid', 'releases.name', 'releases.size', 'releases.groups_id', 'releases.nfostatus', 'releases.fromname', 'releases.completion', 'releases.categories_id', 'releases.searchname', 'releases.predb_id', 'categories.disablepreview'])
@@ -530,12 +530,12 @@  discard block
 block discarded – undo
530 530
             cli_set_process_title($this->_showCLIReleaseID.$this->_release->id);
531 531
 
532 532
             // Create folder to store temporary files.
533
-            if (! $this->_createTempFolder()) {
533
+            if (!$this->_createTempFolder()) {
534 534
                 continue;
535 535
             }
536 536
 
537 537
             // Get NZB contents.
538
-            if (! $this->_getNZBContents()) {
538
+            if (!$this->_getNZBContents()) {
539 539
                 continue;
540 540
             }
541 541
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                 $this->_processMessageIDDownloads();
558 558
 
559 559
                 // Process compressed (RAR/ZIP) files inside the NZB.
560
-                if (! $bookFlood && $this->_NZBHasCompressedFile) {
560
+                if (!$bookFlood && $this->_NZBHasCompressedFile) {
561 561
                     // Download the RARs/ZIPs, extract the files inside them and insert the file info into the DB.
562 562
                     $this->_processNZBCompressedFiles();
563 563
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                         $this->_processNZBCompressedFiles(true);
567 567
                     }
568 568
 
569
-                    if (! $this->_releaseHasPassword) {
569
+                    if (!$this->_releaseHasPassword) {
570 570
                         // Process the extracted files to get video/audio samples/etc.
571 571
                         $this->_processExtractedFiles();
572 572
                     }
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
     {
612 612
         // Per release defaults.
613 613
         $this->tmpPath = $this->_mainTmpPath.$this->_release->guid.'/';
614
-        if (! File::isDirectory($this->tmpPath)) {
615
-            if (! File::makeDirectory($this->tmpPath, 0777, true, false) && ! File::isDirectory($this->tmpPath)) {
614
+        if (!File::isDirectory($this->tmpPath)) {
615
+            if (!File::makeDirectory($this->tmpPath, 0777, true, false) && !File::isDirectory($this->tmpPath)) {
616 616
                 $this->_echo('Unable to create directory: '.$this->tmpPath, 'warning');
617 617
                 $this->_deleteRelease();
618 618
 
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
         $nzbPath = $this->_nzb->NZBPath($this->_release->guid);
635 635
         if ($nzbPath !== false) {
636 636
             $nzbContents = Utility::unzipGzipFile($nzbPath);
637
-            if (! $nzbContents) {
637
+            if (!$nzbContents) {
638 638
                 $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning');
639 639
                 $this->_deleteRelease();
640 640
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                 }
690 690
 
691 691
                 // Check if it's a rar/zip.
692
-                if (! $this->_NZBHasCompressedFile &&
692
+                if (!$this->_NZBHasCompressedFile &&
693 693
                     preg_match(
694 694
                         '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i',
695 695
                         $this->_currentNZBFile['title']
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
                 }
700 700
 
701 701
                 // Look for a video sample, make sure it's not an image.
702
-                if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title'])
702
+                if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title'])
703 703
                 ) {
704 704
                     // Get the amount of segments for this file.
705 705
                     $segCount = (\count($this->_currentNZBFile['segments']) - 1);
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                 }
714 714
 
715 715
                 // Look for a JPG picture, make sure it's not a CD cover.
716
-                if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && ! preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title'])
716
+                if ($this->_processJPGSample && empty($this->_JPGMessageIDs) && isset($this->_currentNZBFile['segments']) && !preg_match('/flac|lossless|mp3|music|inner-sanctum|sound/i', $this->_releaseGroupName) && preg_match('/\.jpe?g[. ")\]]/i', $this->_currentNZBFile['title'])
717 717
                 ) {
718 718
                     // Get the amount of segments for this file.
719 719
                     $segCount = (\count($this->_currentNZBFile['segments']) - 1);
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         $this->_reverse = $reverse;
766 766
 
767 767
         if ($this->_reverse) {
768
-            if (! krsort($this->_nzbContents)) {
768
+            if (!krsort($this->_nzbContents)) {
769 769
                 return;
770 770
             }
771 771
         } else {
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
             }
790 790
 
791 791
             // Probably not a rar/zip.
792
-            if (! preg_match(
792
+            if (!preg_match(
793 793
                 '/\.(part\d+|[r|z]\d+|rar|0+|0*10?|zipr\d{2,3}|zipx?)(\s*\.rar)*($|[ ")\]-])|"[a-f0-9]{32}\.[1-9]\d{1,2}".*\(\d+\/\d{2,}\)$/i',
794 794
                 $nzbFile['title']
795 795
             )
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
                     break;
806 806
                 }
807 807
                 $segment = (string) $nzbFile['segments'][$i];
808
-                if (! $this->_reverse) {
808
+                if (!$this->_reverse) {
809 809
                     $this->_triedCompressedMids[] = $segment;
810 810
                 } elseif (\in_array($segment, $this->_triedCompressedMids, false)) {
811 811
                     // We already downloaded this file.
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
     {
858 858
         $this->_compressedFilesChecked++;
859 859
         // Give the data to archive info so it can check if it's a rar.
860
-        if (! $this->_archiveInfo->setData($compressedData, true)) {
860
+        if (!$this->_archiveInfo->setData($compressedData, true)) {
861 861
             if (config('app.debug') === true) {
862 862
                 $this->_debug('Data is probably not RAR or ZIP.');
863 863
             }
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
         }
888 888
 
889 889
         // Check if the compressed file is encrypted.
890
-        if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) {
890
+        if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) {
891 891
             if (config('app.debug') === true) {
892 892
                 $this->_debug('ArchiveInfo: Compressed file has a password.');
893 893
             }
@@ -899,13 +899,13 @@  discard block
 block discarded – undo
899 899
 
900 900
         if ($this->_reverse) {
901 901
             $fileData = $dataSummary['file_list'] ?? [];
902
-            if (! empty($fileData)) {
902
+            if (!empty($fileData)) {
903 903
                 $rarFileName = Arr::pluck($fileData, 'name');
904 904
                 if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) {
905 905
                     $preCheck = Predb::whereTitle($hit[0])->first();
906 906
                     $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0;
907 907
                     (new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid);
908
-                } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
908
+                } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
909 909
                     $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list'];
910 910
                     $archiveFileName = Arr::pluck($archiveData, 'name');
911 911
                     if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) {
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
                     $this->_echo('r', 'primaryOver');
924 924
                 }
925 925
 
926
-                if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) {
926
+                if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) {
927 927
                     $fileName = $this->tmpPath.uniqid('', true).'.rar';
928 928
                     File::put($fileName, $compressedData);
929 929
                     runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"');
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                     $this->_echo('7z', 'primaryOver');
936 936
                 }
937 937
 
938
-                if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) {
938
+                if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) {
939 939
                     $fileName = $this->tmpPath.uniqid('', true).'.7z';
940 940
                     File::put($fileName, $compressedData);
941 941
                     // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
                     $this->_echo('z', 'primaryOver');
949 949
                 }
950 950
 
951
-                if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) {
951
+                if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) {
952 952
                     $fileName = $this->tmpPath.uniqid('', true).'.zip';
953 953
                     File::put($fileName, $compressedData);
954 954
                     // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
     {
974 974
         // Get a list of files inside the Compressed file.
975 975
         $files = $this->_archiveInfo->getArchiveFileList();
976
-        if (! \is_array($files) || \count($files) === 0) {
976
+        if (!\is_array($files) || \count($files) === 0) {
977 977
             return false;
978 978
         }
979 979
 
@@ -1043,8 +1043,8 @@  discard block
 block discarded – undo
1043 1043
     protected function _addFileInfo(&$file): void
1044 1044
     {
1045 1045
         // Don't add rar/zip files to the DB.
1046
-        if (! isset($file['error']) && isset($file['source']) &&
1047
-            ! preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name'])
1046
+        if (!isset($file['error']) && isset($file['source']) &&
1047
+            !preg_match($this->_supportFileRegex.'|part\d+|[r|z]\d{1,3}|zipr\d{2,3}|\d{2,3}|zipx|zip|rar)(\s*\.rar)?$/i', $file['name'])
1048 1048
         ) {
1049 1049
             // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content.
1050 1050
             // This is so we don't download more RAR or ZIP files for no reason.
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
              */
1056 1056
             if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) {
1057 1057
                 $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? '');
1058
-                if (! empty($addReleaseFiles)) {
1058
+                if (!empty($addReleaseFiles)) {
1059 1059
                     $this->_addedFileInfo++;
1060 1060
 
1061 1061
                     if ($this->_echoCLI) {
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
                         $this->_releaseHasPassword = true;
1073 1073
                         $this->_passwordStatus = Releases::PASSWD_RAR;
1074 1074
                     } //Run a PreDB filename check on insert to try and match the release
1075
-                    elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) {
1075
+                    elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) {
1076 1076
                         $this->_release['filename'] = $file['name'];
1077 1077
                         $this->_release['releases_id'] = $this->_release->id;
1078 1078
                         $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true);
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
             }
1119 1119
 
1120 1120
             // If we found no compressed files, break out.
1121
-            if (! $foundCompressedFile) {
1121
+            if (!$foundCompressedFile) {
1122 1122
                 break;
1123 1123
             }
1124 1124
 
@@ -1140,39 +1140,39 @@  discard block
 block discarded – undo
1140 1140
 
1141 1141
                 if (File::isFile($file)) {
1142 1142
                     // Process PAR2 files.
1143
-                    if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1143
+                    if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1144 1144
                         $this->_siftPAR2Info($file);
1145 1145
                     } // Process NFO files.
1146 1146
                     elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) {
1147 1147
                         $this->_processNfoFile($file);
1148 1148
                     } // Process audio files.
1149
-                    elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1149
+                    elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1150 1150
                         // Try to get audio sample/audio media info.
1151 1151
                         File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]);
1152 1152
                         $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]);
1153 1153
                         File::delete($this->tmpPath.'audiofile.'.$fileType[2]);
1154 1154
                     } // Process JPG files.
1155
-                    elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1155
+                    elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1156 1156
                         $this->_getJPGSample($file);
1157 1157
                         File::delete($file);
1158 1158
                     } // Video sample // video clip // video media info.
1159
-                    elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1159
+                    elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1160 1160
                         $this->_processVideoFile($file);
1161 1161
                     } // Check file's magic info.
1162 1162
                     else {
1163 1163
                         $output = Utility::fileInfo($file);
1164
-                        if (! empty($output)) {
1164
+                        if (!empty($output)) {
1165 1165
                             switch (true) {
1166
-                                case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1166
+                                case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1167 1167
                                     $this->_getJPGSample($file);
1168 1168
                                     File::delete($file);
1169 1169
                                     break;
1170 1170
 
1171
-                                case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1171
+                                case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1172 1172
                                     $this->_processVideoFile($file);
1173 1173
                                     break;
1174 1174
 
1175
-                                case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1175
+                                case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1176 1176
                                     switch ($fileType[0]) {
1177 1177
                                         case 'FLAC':
1178 1178
                                             $fileType = 'FLAC';
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
                                     File::delete($this->tmpPath.'audiofile.'.$fileType);
1190 1190
                                     break;
1191 1191
 
1192
-                                case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1192
+                                case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1193 1193
                                     $this->_siftPAR2Info($file);
1194 1194
                                     break;
1195 1195
                             }
@@ -1225,8 +1225,8 @@  discard block
 block discarded – undo
1225 1225
     protected function _processSampleMessageIDs(): void
1226 1226
     {
1227 1227
         // Download and process sample image.
1228
-        if (! $this->_foundSample || ! $this->_foundVideo) {
1229
-            if (! empty($this->_sampleMessageIDs)) {
1228
+        if (!$this->_foundSample || !$this->_foundVideo) {
1229
+            if (!empty($this->_sampleMessageIDs)) {
1230 1230
                 // Download it from usenet.
1231 1231
                 $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP);
1232 1232
                 if ($this->_nntp::isError($sampleBinary)) {
@@ -1245,12 +1245,12 @@  discard block
 block discarded – undo
1245 1245
                         File::put($fileLocation, $sampleBinary);
1246 1246
 
1247 1247
                         // Try to get a sample picture.
1248
-                        if (! $this->_foundSample) {
1248
+                        if (!$this->_foundSample) {
1249 1249
                             $this->_foundSample = $this->_getSample($fileLocation);
1250 1250
                         }
1251 1251
 
1252 1252
                         // Try to get a sample video.
1253
-                        if (! $this->_foundVideo) {
1253
+                        if (!$this->_foundVideo) {
1254 1254
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1255 1255
                         }
1256 1256
                     }
@@ -1271,8 +1271,8 @@  discard block
 block discarded – undo
1271 1271
     protected function _processMediaInfoMessageIDs(): void
1272 1272
     {
1273 1273
         // Download and process mediainfo. Also try to get a sample if we didn't get one yet.
1274
-        if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) {
1275
-            if (! empty($this->_MediaInfoMessageIDs)) {
1274
+        if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) {
1275
+            if (!empty($this->_MediaInfoMessageIDs)) {
1276 1276
                 // Try to download it from usenet.
1277 1277
                 $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP);
1278 1278
                 if ($this->_nntp::isError($mediaBinary)) {
@@ -1292,17 +1292,17 @@  discard block
 block discarded – undo
1292 1292
                         File::put($fileLocation, $mediaBinary);
1293 1293
 
1294 1294
                         // Try to get media info.
1295
-                        if (! $this->_foundMediaInfo) {
1295
+                        if (!$this->_foundMediaInfo) {
1296 1296
                             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
1297 1297
                         }
1298 1298
 
1299 1299
                         // Try to get a sample picture.
1300
-                        if (! $this->_foundSample) {
1300
+                        if (!$this->_foundSample) {
1301 1301
                             $this->_foundSample = $this->_getSample($fileLocation);
1302 1302
                         }
1303 1303
 
1304 1304
                         // Try to get a sample video.
1305
-                        if (! $this->_foundVideo) {
1305
+                        if (!$this->_foundVideo) {
1306 1306
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1307 1307
                         }
1308 1308
                     }
@@ -1323,8 +1323,8 @@  discard block
 block discarded – undo
1323 1323
     protected function _processAudioInfoMessageIDs(): void
1324 1324
     {
1325 1325
         // Download audio file, use media info to try to get the artist / album.
1326
-        if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) {
1327
-            if (! empty($this->_AudioInfoMessageIDs)) {
1326
+        if (!$this->_foundAudioInfo || !$this->_foundAudioSample) {
1327
+            if (!empty($this->_AudioInfoMessageIDs)) {
1328 1328
                 // Try to download it from usenet.
1329 1329
                 $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP);
1330 1330
                 if ($this->_nntp::isError($audioBinary)) {
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
     protected function _processJPGMessageIDs(): void
1360 1360
     {
1361 1361
         // Download JPG file.
1362
-        if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) {
1362
+        if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) {
1363 1363
             // Try to download it.
1364 1364
             $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP);
1365 1365
             if ($this->_nntp::isError($jpgBinary)) {
@@ -1428,12 +1428,12 @@  discard block
 block discarded – undo
1428 1428
         $this->_passwordStatus = max([$this->_passwordStatus]);
1429 1429
 
1430 1430
         // Set the release to no password if password processing is off.
1431
-        if (! $this->_processPasswords) {
1431
+        if (!$this->_processPasswords) {
1432 1432
             $this->_releaseHasPassword = false;
1433 1433
         }
1434 1434
 
1435 1435
         // If we failed to get anything from the RAR/ZIPs, decrement the passwordstatus, if the rar/zip has no password.
1436
-        if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1436
+        if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1437 1437
             $release = Release::query()->where('id', $this->_release->id);
1438 1438
             $release->decrement('passwordstatus');
1439 1439
             $release->update(
@@ -1491,19 +1491,19 @@  discard block
 block discarded – undo
1491 1491
         $retVal = $audVal = false;
1492 1492
 
1493 1493
         // Check if audio sample fetching is on.
1494
-        if (! $this->_processAudioSample) {
1494
+        if (!$this->_processAudioSample) {
1495 1495
             $audVal = true;
1496 1496
         }
1497 1497
 
1498 1498
         // Check if media info fetching is on.
1499
-        if (! $this->_processAudioInfo) {
1499
+        if (!$this->_processAudioInfo) {
1500 1500
             $retVal = true;
1501 1501
         }
1502 1502
 
1503 1503
         $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first();
1504 1504
 
1505 1505
         $musicParent = (string) Category::MUSIC_ROOT;
1506
-        if ($rQuery === null || ! preg_match(
1506
+        if ($rQuery === null || !preg_match(
1507 1507
             sprintf(
1508 1508
                 '/%d\d{3}|%d|%d|%d/',
1509 1509
                 $musicParent[0],
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 
1520 1520
         if (File::isFile($fileLocation)) {
1521 1521
             // Check if media info is enabled.
1522
-            if (! $retVal) {
1522
+            if (!$retVal) {
1523 1523
                 // Get the media info for the file.
1524 1524
                 try {
1525 1525
                     $xmlArray = $this->mediaInfo->getInfo($fileLocation, false);
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
                                     $ext = strtoupper($fileExtension);
1533 1533
 
1534 1534
                                     // Form a new search name.
1535
-                                    if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1535
+                                    if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1536 1536
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext;
1537 1537
                                     } else {
1538 1538
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext;
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
             }
1595 1595
 
1596 1596
             // Check if creating audio samples is enabled.
1597
-            if (! $audVal) {
1597
+            if (!$audVal) {
1598 1598
                 // File name to store audio file.
1599 1599
                 $audioFileName = ($this->_release->guid.'.ogg');
1600 1600
 
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     // Try to move the temp audio file.
1619 1619
                     $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1620 1620
 
1621
-                    if (! $renamed) {
1621
+                    if (!$renamed) {
1622 1622
                         // Try to copy it if it fails.
1623 1623
                         $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1624 1624
 
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
                         File::delete($this->tmpPath.$audioFileName);
1627 1627
 
1628 1628
                         // If it didn't copy continue.
1629
-                        if (! $copied) {
1629
+                        if (!$copied) {
1630 1630
                             return false;
1631 1631
                         }
1632 1632
                     }
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
             $time = $this->ffprobe->format($videoLocation)->get('duration');
1679 1679
         }
1680 1680
 
1681
-        if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1681
+        if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1682 1682
             return '';
1683 1683
         }
1684 1684
 
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
      */
1700 1700
     protected function _getSample(string $fileLocation): bool
1701 1701
     {
1702
-        if (! $this->_processThumbnails) {
1702
+        if (!$this->_processThumbnails) {
1703 1703
             return false;
1704 1704
         }
1705 1705
 
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
      */
1765 1765
     protected function _getVideo(string $fileLocation): bool
1766 1766
     {
1767
-        if (! $this->_processVideo) {
1767
+        if (!$this->_processVideo) {
1768 1768
             return false;
1769 1769
         }
1770 1770
 
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
             }
1820 1820
 
1821 1821
             // If longer than 60 or we could not get the video length, run the old way.
1822
-            if (! $newMethod && $this->ffprobe->isValid($fileLocation)) {
1822
+            if (!$newMethod && $this->ffprobe->isValid($fileLocation)) {
1823 1823
                 try {
1824 1824
                     $video = $this->ffmpeg->open($fileLocation);
1825 1825
                     $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration));
@@ -1842,14 +1842,14 @@  discard block
 block discarded – undo
1842 1842
 
1843 1843
                 // Try to move the file to the new path.
1844 1844
                 // If we couldn't rename it, try to copy it.
1845
-                if (! @File::move($fileName, $newFile)) {
1845
+                if (!@File::move($fileName, $newFile)) {
1846 1846
                     $copied = @File::copy($fileName, $newFile);
1847 1847
 
1848 1848
                     // Delete the old file.
1849 1849
                     File::delete($fileName);
1850 1850
 
1851 1851
                     // If it didn't copy, continue.
1852
-                    if (! $copied) {
1852
+                    if (!$copied) {
1853 1853
                         return false;
1854 1854
                     }
1855 1855
                 }
@@ -1875,7 +1875,7 @@  discard block
 block discarded – undo
1875 1875
      */
1876 1876
     protected function _getMediaInfo($fileLocation): bool
1877 1877
     {
1878
-        if (! $this->_processMediaInfo) {
1878
+        if (!$this->_processMediaInfo) {
1879 1879
             return false;
1880 1880
         }
1881 1881
 
@@ -1950,7 +1950,7 @@  discard block
 block discarded – undo
1950 1950
         $filesAdded = 0;
1951 1951
 
1952 1952
         foreach ($this->_par2Info->getFileList() as $file) {
1953
-            if (! isset($file['name'])) {
1953
+            if (!isset($file['name'])) {
1954 1954
                 continue;
1955 1955
             }
1956 1956
 
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
             }
1974 1974
 
1975 1975
             // Try to get a new name.
1976
-            if (! $foundName) {
1976
+            if (!$foundName) {
1977 1977
                 $this->_release->textstring = $file['name'];
1978 1978
                 $this->_release->releases_id = $this->_release->id;
1979 1979
                 if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) {
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
     protected function _processVideoFile($fileLocation): void
2004 2004
     {
2005 2005
         // Try to get a sample with it.
2006
-        if (! $this->_foundSample) {
2006
+        if (!$this->_foundSample) {
2007 2007
             $this->_foundSample = $this->_getSample($fileLocation);
2008 2008
         }
2009 2009
 
@@ -2011,12 +2011,12 @@  discard block
 block discarded – undo
2011 2011
          * Don't get it here if _sampleMessageIDs is empty
2012 2012
          * or has 1 message-id (Saves downloading another part).
2013 2013
          */
2014
-        if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
2014
+        if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
2015 2015
             $this->_foundVideo = $this->_getVideo($fileLocation);
2016 2016
         }
2017 2017
 
2018 2018
         // Try to get media info with it.
2019
-        if (! $this->_foundMediaInfo) {
2019
+        if (!$this->_foundMediaInfo) {
2020 2020
             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
2021 2021
         }
2022 2022
     }
@@ -2038,24 +2038,24 @@  discard block
 block discarded – undo
2038 2038
             $bf = true;
2039 2039
         }
2040 2040
 
2041
-        if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2041
+        if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2042 2042
             $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a);
2043 2043
             $af = true;
2044 2044
         }
2045
-        if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2045
+        if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2046 2046
             $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b);
2047 2047
             $bf = true;
2048 2048
         }
2049 2049
 
2050
-        if (! $af && ! $bf) {
2050
+        if (!$af && !$bf) {
2051 2051
             return strnatcasecmp($a, $b);
2052 2052
         }
2053 2053
 
2054
-        if (! $bf) {
2054
+        if (!$bf) {
2055 2055
             return -1;
2056 2056
         }
2057 2057
 
2058
-        if (! $af) {
2058
+        if (!$af) {
2059 2059
             return 1;
2060 2060
         }
2061 2061
 
@@ -2080,12 +2080,12 @@  discard block
 block discarded – undo
2080 2080
     protected function _resetReleaseStatus(): void
2081 2081
     {
2082 2082
         // Only process for samples, previews and images if not disabled.
2083
-        $this->_foundVideo = ! $this->_processVideo;
2084
-        $this->_foundMediaInfo = ! $this->_processMediaInfo;
2085
-        $this->_foundAudioInfo = ! $this->_processAudioInfo;
2086
-        $this->_foundAudioSample = ! $this->_processAudioSample;
2087
-        $this->_foundJPGSample = ! $this->_processJPGSample;
2088
-        $this->_foundSample = ! $this->_processThumbnails;
2083
+        $this->_foundVideo = !$this->_processVideo;
2084
+        $this->_foundMediaInfo = !$this->_processMediaInfo;
2085
+        $this->_foundAudioInfo = !$this->_processAudioInfo;
2086
+        $this->_foundAudioSample = !$this->_processAudioSample;
2087
+        $this->_foundJPGSample = !$this->_processJPGSample;
2088
+        $this->_foundSample = !$this->_processThumbnails;
2089 2089
         $this->_foundPAR2Info = false;
2090 2090
 
2091 2091
         $this->_passwordStatus = Releases::PASSWD_NONE;
Please login to merge, or discard this patch.