Passed
Push — master ( 679b44...0f5302 )
by Darko
07:00
created
Blacklight/processing/post/ProcessAdditional.php 1 patch
Spacing   +90 added lines, -90 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/"');
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
                     $this->_echo('7z', 'primaryOver');
937 937
                 }
938 938
 
939
-                if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) {
939
+                if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) {
940 940
                     $fileName = $this->tmpPath.uniqid('', true).'.zip';
941 941
                     File::put($fileName, $compressedData);
942 942
                     // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
     {
962 962
         // Get a list of files inside the Compressed file.
963 963
         $files = $this->_archiveInfo->getArchiveFileList();
964
-        if (! \is_array($files) || \count($files) === 0) {
964
+        if (!\is_array($files) || \count($files) === 0) {
965 965
             return false;
966 966
         }
967 967
 
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
     protected function _addFileInfo(&$file): void
1032 1032
     {
1033 1033
         // Don't add rar/zip files to the DB.
1034
-        if (! isset($file['error']) && isset($file['source']) &&
1035
-            ! 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'])
1034
+        if (!isset($file['error']) && isset($file['source']) &&
1035
+            !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'])
1036 1036
         ) {
1037 1037
             // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content.
1038 1038
             // This is so we don't download more RAR or ZIP files for no reason.
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
              */
1044 1044
             if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) {
1045 1045
                 $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? '');
1046
-                if (! empty($addReleaseFiles)) {
1046
+                if (!empty($addReleaseFiles)) {
1047 1047
                     $this->_addedFileInfo++;
1048 1048
 
1049 1049
                     if ($this->_echoCLI) {
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
                         $this->_releaseHasPassword = true;
1061 1061
                         $this->_passwordStatus = Releases::PASSWD_RAR;
1062 1062
                     } //Run a PreDB filename check on insert to try and match the release
1063
-                    elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) {
1063
+                    elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) {
1064 1064
                         $this->_release['filename'] = $file['name'];
1065 1065
                         $this->_release['releases_id'] = $this->_release->id;
1066 1066
                         $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true);
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
             }
1107 1107
 
1108 1108
             // If we found no compressed files, break out.
1109
-            if (! $foundCompressedFile) {
1109
+            if (!$foundCompressedFile) {
1110 1110
                 break;
1111 1111
             }
1112 1112
 
@@ -1128,39 +1128,39 @@  discard block
 block discarded – undo
1128 1128
 
1129 1129
                 if (File::isFile($file)) {
1130 1130
                     // Process PAR2 files.
1131
-                    if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1131
+                    if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1132 1132
                         $this->_siftPAR2Info($file);
1133 1133
                     } // Process NFO files.
1134 1134
                     elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) {
1135 1135
                         $this->_processNfoFile($file);
1136 1136
                     } // Process audio files.
1137
-                    elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1137
+                    elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1138 1138
                         // Try to get audio sample/audio media info.
1139 1139
                         File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]);
1140 1140
                         $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]);
1141 1141
                         File::delete($this->tmpPath.'audiofile.'.$fileType[2]);
1142 1142
                     } // Process JPG files.
1143
-                    elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1143
+                    elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1144 1144
                         $this->_getJPGSample($file);
1145 1145
                         File::delete($file);
1146 1146
                     } // Video sample // video clip // video media info.
1147
-                    elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1147
+                    elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1148 1148
                         $this->_processVideoFile($file);
1149 1149
                     } // Check file's magic info.
1150 1150
                     else {
1151 1151
                         $output = Utility::fileInfo($file);
1152
-                        if (! empty($output)) {
1152
+                        if (!empty($output)) {
1153 1153
                             switch (true) {
1154
-                                case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1154
+                                case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1155 1155
                                     $this->_getJPGSample($file);
1156 1156
                                     File::delete($file);
1157 1157
                                     break;
1158 1158
 
1159
-                                case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1159
+                                case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1160 1160
                                     $this->_processVideoFile($file);
1161 1161
                                     break;
1162 1162
 
1163
-                                case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1163
+                                case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1164 1164
                                     switch ($fileType[0]) {
1165 1165
                                         case 'FLAC':
1166 1166
                                             $fileType = 'FLAC';
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
                                     File::delete($this->tmpPath.'audiofile.'.$fileType);
1178 1178
                                     break;
1179 1179
 
1180
-                                case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1180
+                                case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1181 1181
                                     $this->_siftPAR2Info($file);
1182 1182
                                     break;
1183 1183
                             }
@@ -1213,8 +1213,8 @@  discard block
 block discarded – undo
1213 1213
     protected function _processSampleMessageIDs(): void
1214 1214
     {
1215 1215
         // Download and process sample image.
1216
-        if (! $this->_foundSample || ! $this->_foundVideo) {
1217
-            if (! empty($this->_sampleMessageIDs)) {
1216
+        if (!$this->_foundSample || !$this->_foundVideo) {
1217
+            if (!empty($this->_sampleMessageIDs)) {
1218 1218
                 // Download it from usenet.
1219 1219
                 $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP);
1220 1220
                 if ($this->_nntp::isError($sampleBinary)) {
@@ -1233,12 +1233,12 @@  discard block
 block discarded – undo
1233 1233
                         File::put($fileLocation, $sampleBinary);
1234 1234
 
1235 1235
                         // Try to get a sample picture.
1236
-                        if (! $this->_foundSample) {
1236
+                        if (!$this->_foundSample) {
1237 1237
                             $this->_foundSample = $this->_getSample($fileLocation);
1238 1238
                         }
1239 1239
 
1240 1240
                         // Try to get a sample video.
1241
-                        if (! $this->_foundVideo) {
1241
+                        if (!$this->_foundVideo) {
1242 1242
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1243 1243
                         }
1244 1244
                     }
@@ -1259,8 +1259,8 @@  discard block
 block discarded – undo
1259 1259
     protected function _processMediaInfoMessageIDs(): void
1260 1260
     {
1261 1261
         // Download and process mediainfo. Also try to get a sample if we didn't get one yet.
1262
-        if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) {
1263
-            if (! empty($this->_MediaInfoMessageIDs)) {
1262
+        if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) {
1263
+            if (!empty($this->_MediaInfoMessageIDs)) {
1264 1264
                 // Try to download it from usenet.
1265 1265
                 $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP);
1266 1266
                 if ($this->_nntp::isError($mediaBinary)) {
@@ -1280,17 +1280,17 @@  discard block
 block discarded – undo
1280 1280
                         File::put($fileLocation, $mediaBinary);
1281 1281
 
1282 1282
                         // Try to get media info.
1283
-                        if (! $this->_foundMediaInfo) {
1283
+                        if (!$this->_foundMediaInfo) {
1284 1284
                             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
1285 1285
                         }
1286 1286
 
1287 1287
                         // Try to get a sample picture.
1288
-                        if (! $this->_foundSample) {
1288
+                        if (!$this->_foundSample) {
1289 1289
                             $this->_foundSample = $this->_getSample($fileLocation);
1290 1290
                         }
1291 1291
 
1292 1292
                         // Try to get a sample video.
1293
-                        if (! $this->_foundVideo) {
1293
+                        if (!$this->_foundVideo) {
1294 1294
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1295 1295
                         }
1296 1296
                     }
@@ -1311,8 +1311,8 @@  discard block
 block discarded – undo
1311 1311
     protected function _processAudioInfoMessageIDs(): void
1312 1312
     {
1313 1313
         // Download audio file, use media info to try to get the artist / album.
1314
-        if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) {
1315
-            if (! empty($this->_AudioInfoMessageIDs)) {
1314
+        if (!$this->_foundAudioInfo || !$this->_foundAudioSample) {
1315
+            if (!empty($this->_AudioInfoMessageIDs)) {
1316 1316
                 // Try to download it from usenet.
1317 1317
                 $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP);
1318 1318
                 if ($this->_nntp::isError($audioBinary)) {
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
     protected function _processJPGMessageIDs(): void
1348 1348
     {
1349 1349
         // Download JPG file.
1350
-        if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) {
1350
+        if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) {
1351 1351
             // Try to download it.
1352 1352
             $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP);
1353 1353
             if ($this->_nntp::isError($jpgBinary)) {
@@ -1416,12 +1416,12 @@  discard block
 block discarded – undo
1416 1416
         $this->_passwordStatus = max([$this->_passwordStatus]);
1417 1417
 
1418 1418
         // Set the release to no password if password processing is off.
1419
-        if (! $this->_processPasswords) {
1419
+        if (!$this->_processPasswords) {
1420 1420
             $this->_releaseHasPassword = false;
1421 1421
         }
1422 1422
 
1423 1423
         // If we failed to get anything from the RAR/ZIPs, decrement the passwordstatus, if the rar/zip has no password.
1424
-        if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1424
+        if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1425 1425
             $release = Release::query()->where('id', $this->_release->id);
1426 1426
             $release->decrement('passwordstatus');
1427 1427
             $release->update(
@@ -1479,19 +1479,19 @@  discard block
 block discarded – undo
1479 1479
         $retVal = $audVal = false;
1480 1480
 
1481 1481
         // Check if audio sample fetching is on.
1482
-        if (! $this->_processAudioSample) {
1482
+        if (!$this->_processAudioSample) {
1483 1483
             $audVal = true;
1484 1484
         }
1485 1485
 
1486 1486
         // Check if media info fetching is on.
1487
-        if (! $this->_processAudioInfo) {
1487
+        if (!$this->_processAudioInfo) {
1488 1488
             $retVal = true;
1489 1489
         }
1490 1490
 
1491 1491
         $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first();
1492 1492
 
1493 1493
         $musicParent = (string) Category::MUSIC_ROOT;
1494
-        if ($rQuery === null || ! preg_match(
1494
+        if ($rQuery === null || !preg_match(
1495 1495
             sprintf(
1496 1496
                 '/%d\d{3}|%d|%d|%d/',
1497 1497
                 $musicParent[0],
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 
1508 1508
         if (File::isFile($fileLocation)) {
1509 1509
             // Check if media info is enabled.
1510
-            if (! $retVal) {
1510
+            if (!$retVal) {
1511 1511
                 // Get the media info for the file.
1512 1512
                 try {
1513 1513
                     $xmlArray = $this->mediaInfo->getInfo($fileLocation, false);
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
                                     $ext = strtoupper($fileExtension);
1521 1521
 
1522 1522
                                     // Form a new search name.
1523
-                                    if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1523
+                                    if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1524 1524
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext;
1525 1525
                                     } else {
1526 1526
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext;
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
             }
1583 1583
 
1584 1584
             // Check if creating audio samples is enabled.
1585
-            if (! $audVal) {
1585
+            if (!$audVal) {
1586 1586
                 // File name to store audio file.
1587 1587
                 $audioFileName = ($this->_release->guid.'.ogg');
1588 1588
 
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
                     // Try to move the temp audio file.
1607 1607
                     $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1608 1608
 
1609
-                    if (! $renamed) {
1609
+                    if (!$renamed) {
1610 1610
                         // Try to copy it if it fails.
1611 1611
                         $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1612 1612
 
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
                         File::delete($this->tmpPath.$audioFileName);
1615 1615
 
1616 1616
                         // If it didn't copy continue.
1617
-                        if (! $copied) {
1617
+                        if (!$copied) {
1618 1618
                             return false;
1619 1619
                         }
1620 1620
                     }
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
             $time = $this->ffprobe->format($videoLocation)->get('duration');
1667 1667
         }
1668 1668
 
1669
-        if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1669
+        if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1670 1670
             return '';
1671 1671
         }
1672 1672
 
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
      */
1688 1688
     protected function _getSample(string $fileLocation): bool
1689 1689
     {
1690
-        if (! $this->_processThumbnails) {
1690
+        if (!$this->_processThumbnails) {
1691 1691
             return false;
1692 1692
         }
1693 1693
 
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
      */
1753 1753
     protected function _getVideo(string $fileLocation): bool
1754 1754
     {
1755
-        if (! $this->_processVideo) {
1755
+        if (!$this->_processVideo) {
1756 1756
             return false;
1757 1757
         }
1758 1758
 
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
             }
1808 1808
 
1809 1809
             // If longer than 60 or we could not get the video length, run the old way.
1810
-            if (! $newMethod && $this->ffprobe->isValid($fileLocation)) {
1810
+            if (!$newMethod && $this->ffprobe->isValid($fileLocation)) {
1811 1811
                 try {
1812 1812
                     $video = $this->ffmpeg->open($fileLocation);
1813 1813
                     $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration));
@@ -1830,14 +1830,14 @@  discard block
 block discarded – undo
1830 1830
 
1831 1831
                 // Try to move the file to the new path.
1832 1832
                 // If we couldn't rename it, try to copy it.
1833
-                if (! @File::move($fileName, $newFile)) {
1833
+                if (!@File::move($fileName, $newFile)) {
1834 1834
                     $copied = @File::copy($fileName, $newFile);
1835 1835
 
1836 1836
                     // Delete the old file.
1837 1837
                     File::delete($fileName);
1838 1838
 
1839 1839
                     // If it didn't copy, continue.
1840
-                    if (! $copied) {
1840
+                    if (!$copied) {
1841 1841
                         return false;
1842 1842
                     }
1843 1843
                 }
@@ -1863,7 +1863,7 @@  discard block
 block discarded – undo
1863 1863
      */
1864 1864
     protected function _getMediaInfo($fileLocation): bool
1865 1865
     {
1866
-        if (! $this->_processMediaInfo) {
1866
+        if (!$this->_processMediaInfo) {
1867 1867
             return false;
1868 1868
         }
1869 1869
 
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
         $filesAdded = 0;
1939 1939
 
1940 1940
         foreach ($this->_par2Info->getFileList() as $file) {
1941
-            if (! isset($file['name'])) {
1941
+            if (!isset($file['name'])) {
1942 1942
                 continue;
1943 1943
             }
1944 1944
 
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
             }
1962 1962
 
1963 1963
             // Try to get a new name.
1964
-            if (! $foundName) {
1964
+            if (!$foundName) {
1965 1965
                 $this->_release->textstring = $file['name'];
1966 1966
                 $this->_release->releases_id = $this->_release->id;
1967 1967
                 if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) {
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
     protected function _processVideoFile($fileLocation): void
1992 1992
     {
1993 1993
         // Try to get a sample with it.
1994
-        if (! $this->_foundSample) {
1994
+        if (!$this->_foundSample) {
1995 1995
             $this->_foundSample = $this->_getSample($fileLocation);
1996 1996
         }
1997 1997
 
@@ -1999,12 +1999,12 @@  discard block
 block discarded – undo
1999 1999
          * Don't get it here if _sampleMessageIDs is empty
2000 2000
          * or has 1 message-id (Saves downloading another part).
2001 2001
          */
2002
-        if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
2002
+        if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
2003 2003
             $this->_foundVideo = $this->_getVideo($fileLocation);
2004 2004
         }
2005 2005
 
2006 2006
         // Try to get media info with it.
2007
-        if (! $this->_foundMediaInfo) {
2007
+        if (!$this->_foundMediaInfo) {
2008 2008
             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
2009 2009
         }
2010 2010
     }
@@ -2026,24 +2026,24 @@  discard block
 block discarded – undo
2026 2026
             $bf = true;
2027 2027
         }
2028 2028
 
2029
-        if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2029
+        if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2030 2030
             $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a);
2031 2031
             $af = true;
2032 2032
         }
2033
-        if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2033
+        if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2034 2034
             $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b);
2035 2035
             $bf = true;
2036 2036
         }
2037 2037
 
2038
-        if (! $af && ! $bf) {
2038
+        if (!$af && !$bf) {
2039 2039
             return strnatcasecmp($a, $b);
2040 2040
         }
2041 2041
 
2042
-        if (! $bf) {
2042
+        if (!$bf) {
2043 2043
             return -1;
2044 2044
         }
2045 2045
 
2046
-        if (! $af) {
2046
+        if (!$af) {
2047 2047
             return 1;
2048 2048
         }
2049 2049
 
@@ -2068,12 +2068,12 @@  discard block
 block discarded – undo
2068 2068
     protected function _resetReleaseStatus(): void
2069 2069
     {
2070 2070
         // Only process for samples, previews and images if not disabled.
2071
-        $this->_foundVideo = ! $this->_processVideo;
2072
-        $this->_foundMediaInfo = ! $this->_processMediaInfo;
2073
-        $this->_foundAudioInfo = ! $this->_processAudioInfo;
2074
-        $this->_foundAudioSample = ! $this->_processAudioSample;
2075
-        $this->_foundJPGSample = ! $this->_processJPGSample;
2076
-        $this->_foundSample = ! $this->_processThumbnails;
2071
+        $this->_foundVideo = !$this->_processVideo;
2072
+        $this->_foundMediaInfo = !$this->_processMediaInfo;
2073
+        $this->_foundAudioInfo = !$this->_processAudioInfo;
2074
+        $this->_foundAudioSample = !$this->_processAudioSample;
2075
+        $this->_foundJPGSample = !$this->_processJPGSample;
2076
+        $this->_foundSample = !$this->_processThumbnails;
2077 2077
         $this->_foundPAR2Info = false;
2078 2078
 
2079 2079
         $this->_passwordStatus = Releases::PASSWD_NONE;
Please login to merge, or discard this patch.