Passed
Push — master ( f54e72...739e58 )
by Darko
05:55
created
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
                 if ($this->_echoCLI) {
639 639
                     $this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning');
640 640
                 }
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
                 }
696 696
 
697 697
                 // Check if it's a rar/zip.
698
-                if (! $this->_NZBHasCompressedFile &&
698
+                if (!$this->_NZBHasCompressedFile &&
699 699
                     preg_match(
700 700
                         '/\.(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',
701 701
                         $this->_currentNZBFile['title']
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
                 }
706 706
 
707 707
                 // Look for a video sample, make sure it's not an image.
708
-                if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && ! preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title'])
708
+                if ($this->_processThumbnails && empty($this->_sampleMessageIDs) && isset($this->_currentNZBFile['segments']) && stripos($this->_currentNZBFile['title'], 'sample') !== false && !preg_match('/\.jpe?g$/i', $this->_currentNZBFile['title'])
709 709
                 ) {
710 710
                     // Get the amount of segments for this file.
711 711
                     $segCount = (\count($this->_currentNZBFile['segments']) - 1);
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
                 }
720 720
 
721 721
                 // Look for a JPG picture, make sure it's not a CD cover.
722
-                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'])
722
+                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'])
723 723
                 ) {
724 724
                     // Get the amount of segments for this file.
725 725
                     $segCount = (\count($this->_currentNZBFile['segments']) - 1);
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
         $this->_reverse = $reverse;
772 772
 
773 773
         if ($this->_reverse) {
774
-            if (! krsort($this->_nzbContents)) {
774
+            if (!krsort($this->_nzbContents)) {
775 775
                 return;
776 776
             }
777 777
         } else {
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
             }
796 796
 
797 797
             // Probably not a rar/zip.
798
-            if (! preg_match(
798
+            if (!preg_match(
799 799
                 '/\.(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',
800 800
                 $nzbFile['title']
801 801
             )
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                     break;
812 812
                 }
813 813
                 $segment = (string) $nzbFile['segments'][$i];
814
-                if (! $this->_reverse) {
814
+                if (!$this->_reverse) {
815 815
                     $this->_triedCompressedMids[] = $segment;
816 816
                 } elseif (\in_array($segment, $this->_triedCompressedMids, false)) {
817 817
                     // We already downloaded this file.
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
     {
864 864
         $this->_compressedFilesChecked++;
865 865
         // Give the data to archive info so it can check if it's a rar.
866
-        if (! $this->_archiveInfo->setData($compressedData, true)) {
866
+        if (!$this->_archiveInfo->setData($compressedData, true)) {
867 867
             if (config('app.debug') === true) {
868 868
                 $this->_debug('Data is probably not RAR or ZIP.');
869 869
             }
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
         }
894 894
 
895 895
         // Check if the compressed file is encrypted.
896
-        if (! empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) {
896
+        if (!empty($this->_archiveInfo->isEncrypted) || (isset($dataSummary['is_encrypted']) && (int) $dataSummary['is_encrypted'] !== 0)) {
897 897
             if (config('app.debug') === true) {
898 898
                 $this->_debug('ArchiveInfo: Compressed file has a password.');
899 899
             }
@@ -905,13 +905,13 @@  discard block
 block discarded – undo
905 905
 
906 906
         if ($this->_reverse) {
907 907
             $fileData = $dataSummary['file_list'] ?? [];
908
-            if (! empty($fileData)) {
908
+            if (!empty($fileData)) {
909 909
                 $rarFileName = Arr::pluck($fileData, 'name');
910 910
                 if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) {
911 911
                     $preCheck = Predb::whereTitle($hit[0])->first();
912 912
                     $this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0;
913 913
                     (new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', true, true, $this->_release->preid);
914
-                } elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
914
+                } elseif (!empty($dataSummary['archives']) && !empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
915 915
                     $archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list'];
916 916
                     $archiveFileName = Arr::pluck($archiveData, 'name');
917 917
                     if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) {
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
                     $this->_echo('r', 'primaryOver');
930 930
                 }
931 931
 
932
-                if (! $this->_extractUsingRarInfo && $this->_unrarPath !== false) {
932
+                if (!$this->_extractUsingRarInfo && $this->_unrarPath !== false) {
933 933
                     $fileName = $this->tmpPath.uniqid('', true).'.rar';
934 934
                     File::put($fileName, $compressedData);
935 935
                     runCmd($this->_killString.$this->_unrarPath.'" e -ai -ep -c- -id -inul -kb -or -p- -r -y "'.$fileName.'" "'.$this->tmpPath.'unrar/"');
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
                     $this->_echo('7z', 'primaryOver');
942 942
                 }
943 943
 
944
-                if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) {
944
+                if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) {
945 945
                     $fileName = $this->tmpPath.uniqid('', true).'.7z';
946 946
                     File::put($fileName, $compressedData);
947 947
                     // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                     $this->_echo('z', 'primaryOver');
955 955
                 }
956 956
 
957
-                if (! $this->_extractUsingRarInfo && ! empty($this->_7zipPath)) {
957
+                if (!$this->_extractUsingRarInfo && !empty($this->_7zipPath)) {
958 958
                     $fileName = $this->tmpPath.uniqid('', true).'.zip';
959 959
                     File::put($fileName, $compressedData);
960 960
                     // Pass the -p flag to the 7zip command to make sure it doesn't get stuck in password prompt
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
     {
980 980
         // Get a list of files inside the Compressed file.
981 981
         $files = $this->_archiveInfo->getArchiveFileList();
982
-        if (! \is_array($files) || \count($files) === 0) {
982
+        if (!\is_array($files) || \count($files) === 0) {
983 983
             return false;
984 984
         }
985 985
 
@@ -1049,8 +1049,8 @@  discard block
 block discarded – undo
1049 1049
     protected function _addFileInfo(&$file): void
1050 1050
     {
1051 1051
         // Don't add rar/zip files to the DB.
1052
-        if (! isset($file['error']) && isset($file['source']) &&
1053
-            ! 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'])
1052
+        if (!isset($file['error']) && isset($file['source']) &&
1053
+            !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'])
1054 1054
         ) {
1055 1055
             // Cache the amount of files we find in the RAR or ZIP, return this to say we did find RAR or ZIP content.
1056 1056
             // This is so we don't download more RAR or ZIP files for no reason.
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
              */
1062 1062
             if ($this->_addedFileInfo < 11 && ReleaseFile::query()->where(['releases_id' => $this->_release->id, 'name' => $file['name'], 'size' => $file['size']])->first() === null) {
1063 1063
                 $addReleaseFiles = ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? '');
1064
-                if (! empty($addReleaseFiles)) {
1064
+                if (!empty($addReleaseFiles)) {
1065 1065
                     $this->_addedFileInfo++;
1066 1066
 
1067 1067
                     if ($this->_echoCLI) {
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
                         $this->_releaseHasPassword = true;
1079 1079
                         $this->_passwordStatus = Releases::PASSWD_RAR;
1080 1080
                     } //Run a PreDB filename check on insert to try and match the release
1081
-                    elseif ($file['name'] !== '' && ! str_starts_with($file['name'], '.')) {
1081
+                    elseif ($file['name'] !== '' && !str_starts_with($file['name'], '.')) {
1082 1082
                         $this->_release['filename'] = $file['name'];
1083 1083
                         $this->_release['releases_id'] = $this->_release->id;
1084 1084
                         $this->_nameFixer->matchPreDbFiles($this->_release, 1, 1, true);
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
             }
1125 1125
 
1126 1126
             // If we found no compressed files, break out.
1127
-            if (! $foundCompressedFile) {
1127
+            if (!$foundCompressedFile) {
1128 1128
                 break;
1129 1129
             }
1130 1130
 
@@ -1146,39 +1146,39 @@  discard block
 block discarded – undo
1146 1146
 
1147 1147
                 if (File::isFile($file)) {
1148 1148
                     // Process PAR2 files.
1149
-                    if (! $this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1149
+                    if (!$this->_foundPAR2Info && preg_match('/\.par2$/', $file)) {
1150 1150
                         $this->_siftPAR2Info($file);
1151 1151
                     } // Process NFO files.
1152 1152
                     elseif ($this->_releaseHasNoNFO && preg_match('/(\.(nfo|inf|ofn)|info\.txt)$/i', $file)) {
1153 1153
                         $this->_processNfoFile($file);
1154 1154
                     } // Process audio files.
1155
-                    elseif ((! $this->_foundAudioInfo || ! $this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1155
+                    elseif ((!$this->_foundAudioInfo || !$this->_foundAudioSample) && preg_match('/(.*)'.$this->_audioFileRegex.'$/i', $file, $fileType)) {
1156 1156
                         // Try to get audio sample/audio media info.
1157 1157
                         File::move($file, $this->tmpPath.'audiofile.'.$fileType[2]);
1158 1158
                         $this->_getAudioInfo($this->tmpPath.'audiofile.'.$fileType[2], $fileType[2]);
1159 1159
                         File::delete($this->tmpPath.'audiofile.'.$fileType[2]);
1160 1160
                     } // Process JPG files.
1161
-                    elseif (! $this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1161
+                    elseif (!$this->_foundJPGSample && preg_match('/\.jpe?g$/i', $file)) {
1162 1162
                         $this->_getJPGSample($file);
1163 1163
                         File::delete($file);
1164 1164
                     } // Video sample // video clip // video media info.
1165
-                    elseif ((! $this->_foundSample || ! $this->_foundVideo || ! $this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1165
+                    elseif ((!$this->_foundSample || !$this->_foundVideo || !$this->_foundMediaInfo) && preg_match('/(.*)'.$this->_videoFileRegex.'$/i', $file)) {
1166 1166
                         $this->_processVideoFile($file);
1167 1167
                     } // Check file's magic info.
1168 1168
                     else {
1169 1169
                         $output = Utility::fileInfo($file);
1170
-                        if (! empty($output)) {
1170
+                        if (!empty($output)) {
1171 1171
                             switch (true) {
1172
-                                case ! $this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1172
+                                case !$this->_foundJPGSample && preg_match('/^JPE?G/i', $output):
1173 1173
                                     $this->_getJPGSample($file);
1174 1174
                                     File::delete($file);
1175 1175
                                     break;
1176 1176
 
1177
-                                case (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1177
+                                case (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) && preg_match('/Matroska data|MPEG v4|MPEG sequence, v2|\WAVI\W/i', $output):
1178 1178
                                     $this->_processVideoFile($file);
1179 1179
                                     break;
1180 1180
 
1181
-                                case (! $this->_foundAudioSample || ! $this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1181
+                                case (!$this->_foundAudioSample || !$this->_foundAudioInfo) && preg_match('/^FLAC|layer III|Vorbis audio/i', $output, $fileType):
1182 1182
                                     switch ($fileType[0]) {
1183 1183
                                         case 'FLAC':
1184 1184
                                             $fileType = 'FLAC';
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
                                     File::delete($this->tmpPath.'audiofile.'.$fileType);
1196 1196
                                     break;
1197 1197
 
1198
-                                case ! $this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1198
+                                case !$this->_foundPAR2Info && stripos($output, 'Parity') === 0:
1199 1199
                                     $this->_siftPAR2Info($file);
1200 1200
                                     break;
1201 1201
                             }
@@ -1231,8 +1231,8 @@  discard block
 block discarded – undo
1231 1231
     protected function _processSampleMessageIDs(): void
1232 1232
     {
1233 1233
         // Download and process sample image.
1234
-        if (! $this->_foundSample || ! $this->_foundVideo) {
1235
-            if (! empty($this->_sampleMessageIDs)) {
1234
+        if (!$this->_foundSample || !$this->_foundVideo) {
1235
+            if (!empty($this->_sampleMessageIDs)) {
1236 1236
                 // Download it from usenet.
1237 1237
                 $sampleBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_sampleMessageIDs, $this->_alternateNNTP);
1238 1238
                 if ($this->_nntp::isError($sampleBinary)) {
@@ -1251,12 +1251,12 @@  discard block
 block discarded – undo
1251 1251
                         File::put($fileLocation, $sampleBinary);
1252 1252
 
1253 1253
                         // Try to get a sample picture.
1254
-                        if (! $this->_foundSample) {
1254
+                        if (!$this->_foundSample) {
1255 1255
                             $this->_foundSample = $this->_getSample($fileLocation);
1256 1256
                         }
1257 1257
 
1258 1258
                         // Try to get a sample video.
1259
-                        if (! $this->_foundVideo) {
1259
+                        if (!$this->_foundVideo) {
1260 1260
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1261 1261
                         }
1262 1262
                     }
@@ -1277,8 +1277,8 @@  discard block
 block discarded – undo
1277 1277
     protected function _processMediaInfoMessageIDs(): void
1278 1278
     {
1279 1279
         // Download and process mediainfo. Also try to get a sample if we didn't get one yet.
1280
-        if (! $this->_foundMediaInfo || ! $this->_foundSample || ! $this->_foundVideo) {
1281
-            if (! empty($this->_MediaInfoMessageIDs)) {
1280
+        if (!$this->_foundMediaInfo || !$this->_foundSample || !$this->_foundVideo) {
1281
+            if (!empty($this->_MediaInfoMessageIDs)) {
1282 1282
                 // Try to download it from usenet.
1283 1283
                 $mediaBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_MediaInfoMessageIDs, $this->_alternateNNTP);
1284 1284
                 if ($this->_nntp::isError($mediaBinary)) {
@@ -1298,17 +1298,17 @@  discard block
 block discarded – undo
1298 1298
                         File::put($fileLocation, $mediaBinary);
1299 1299
 
1300 1300
                         // Try to get media info.
1301
-                        if (! $this->_foundMediaInfo) {
1301
+                        if (!$this->_foundMediaInfo) {
1302 1302
                             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
1303 1303
                         }
1304 1304
 
1305 1305
                         // Try to get a sample picture.
1306
-                        if (! $this->_foundSample) {
1306
+                        if (!$this->_foundSample) {
1307 1307
                             $this->_foundSample = $this->_getSample($fileLocation);
1308 1308
                         }
1309 1309
 
1310 1310
                         // Try to get a sample video.
1311
-                        if (! $this->_foundVideo) {
1311
+                        if (!$this->_foundVideo) {
1312 1312
                             $this->_foundVideo = $this->_getVideo($fileLocation);
1313 1313
                         }
1314 1314
                     }
@@ -1329,8 +1329,8 @@  discard block
 block discarded – undo
1329 1329
     protected function _processAudioInfoMessageIDs(): void
1330 1330
     {
1331 1331
         // Download audio file, use media info to try to get the artist / album.
1332
-        if (! $this->_foundAudioInfo || ! $this->_foundAudioSample) {
1333
-            if (! empty($this->_AudioInfoMessageIDs)) {
1332
+        if (!$this->_foundAudioInfo || !$this->_foundAudioSample) {
1333
+            if (!empty($this->_AudioInfoMessageIDs)) {
1334 1334
                 // Try to download it from usenet.
1335 1335
                 $audioBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_AudioInfoMessageIDs, $this->_alternateNNTP);
1336 1336
                 if ($this->_nntp::isError($audioBinary)) {
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
     protected function _processJPGMessageIDs(): void
1366 1366
     {
1367 1367
         // Download JPG file.
1368
-        if (! $this->_foundJPGSample && ! empty($this->_JPGMessageIDs)) {
1368
+        if (!$this->_foundJPGSample && !empty($this->_JPGMessageIDs)) {
1369 1369
             // Try to download it.
1370 1370
             $jpgBinary = $this->_nntp->getMessages($this->_releaseGroupName, $this->_JPGMessageIDs, $this->_alternateNNTP);
1371 1371
             if ($this->_nntp::isError($jpgBinary)) {
@@ -1434,12 +1434,12 @@  discard block
 block discarded – undo
1434 1434
         $this->_passwordStatus = max([$this->_passwordStatus]);
1435 1435
 
1436 1436
         // Set the release to no password if password processing is off.
1437
-        if (! $this->_processPasswords) {
1437
+        if (!$this->_processPasswords) {
1438 1438
             $this->_releaseHasPassword = false;
1439 1439
         }
1440 1440
 
1441 1441
         // If we failed to get anything from the RAR/ZIPs, decrement the passwordstatus, if the rar/zip has no password.
1442
-        if (! $this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1442
+        if (!$this->_releaseHasPassword && $this->_NZBHasCompressedFile && $releaseFilesCount === 0) {
1443 1443
             $release = Release::query()->where('id', $this->_release->id);
1444 1444
             $release->decrement('passwordstatus');
1445 1445
             $release->update(
@@ -1497,19 +1497,19 @@  discard block
 block discarded – undo
1497 1497
         $retVal = $audVal = false;
1498 1498
 
1499 1499
         // Check if audio sample fetching is on.
1500
-        if (! $this->_processAudioSample) {
1500
+        if (!$this->_processAudioSample) {
1501 1501
             $audVal = true;
1502 1502
         }
1503 1503
 
1504 1504
         // Check if media info fetching is on.
1505
-        if (! $this->_processAudioInfo) {
1505
+        if (!$this->_processAudioInfo) {
1506 1506
             $retVal = true;
1507 1507
         }
1508 1508
 
1509 1509
         $rQuery = Release::query()->where('proc_pp', '=', 0)->where('id', $this->_release->id)->select(['searchname', 'fromname', 'categories_id'])->first();
1510 1510
 
1511 1511
         $musicParent = (string) Category::MUSIC_ROOT;
1512
-        if ($rQuery === null || ! preg_match(
1512
+        if ($rQuery === null || !preg_match(
1513 1513
             sprintf(
1514 1514
                 '/%d\d{3}|%d|%d|%d/',
1515 1515
                 $musicParent[0],
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 
1526 1526
         if (File::isFile($fileLocation)) {
1527 1527
             // Check if media info is enabled.
1528
-            if (! $retVal) {
1528
+            if (!$retVal) {
1529 1529
                 // Get the media info for the file.
1530 1530
                 try {
1531 1531
                     $xmlArray = $this->mediaInfo->getInfo($fileLocation, false);
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
                                     $ext = strtoupper($fileExtension);
1539 1539
 
1540 1540
                                     // Form a new search name.
1541
-                                    if (! empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1541
+                                    if (!empty($track->get('recorded_date')) && preg_match('/(?:19|20)\d\d/', $track->get('recorded_date')->getFullname(), $Year)) {
1542 1542
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' ('.$Year[0].') '.$ext;
1543 1543
                                     } else {
1544 1544
                                         $newName = $track->get('performer')->getFullName().' - '.$track->get('album')->getFullName().' '.$ext;
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
             }
1601 1601
 
1602 1602
             // Check if creating audio samples is enabled.
1603
-            if (! $audVal) {
1603
+            if (!$audVal) {
1604 1604
                 // File name to store audio file.
1605 1605
                 $audioFileName = ($this->_release->guid.'.ogg');
1606 1606
 
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
                     // Try to move the temp audio file.
1625 1625
                     $renamed = File::move($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1626 1626
 
1627
-                    if (! $renamed) {
1627
+                    if (!$renamed) {
1628 1628
                         // Try to copy it if it fails.
1629 1629
                         $copied = File::copy($this->tmpPath.$audioFileName, $this->_audioSavePath.$audioFileName);
1630 1630
 
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
                         File::delete($this->tmpPath.$audioFileName);
1633 1633
 
1634 1634
                         // If it didn't copy continue.
1635
-                        if (! $copied) {
1635
+                        if (!$copied) {
1636 1636
                             return false;
1637 1637
                         }
1638 1638
                     }
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
             $time = $this->ffprobe->format($videoLocation)->get('duration');
1685 1685
         }
1686 1686
 
1687
-        if (empty($time) || ! preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1687
+        if (empty($time) || !preg_match('/time=(\d{1,2}:\d{1,2}:)?(\d{1,2})\.(\d{1,2})\s*bitrate=/i', $time, $numbers)) {
1688 1688
             return '';
1689 1689
         }
1690 1690
 
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
      */
1706 1706
     protected function _getSample(string $fileLocation): bool
1707 1707
     {
1708
-        if (! $this->_processThumbnails) {
1708
+        if (!$this->_processThumbnails) {
1709 1709
             return false;
1710 1710
         }
1711 1711
 
@@ -1770,7 +1770,7 @@  discard block
 block discarded – undo
1770 1770
      */
1771 1771
     protected function _getVideo(string $fileLocation): bool
1772 1772
     {
1773
-        if (! $this->_processVideo) {
1773
+        if (!$this->_processVideo) {
1774 1774
             return false;
1775 1775
         }
1776 1776
 
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
             }
1826 1826
 
1827 1827
             // If longer than 60 or we could not get the video length, run the old way.
1828
-            if (! $newMethod && $this->ffprobe->isValid($fileLocation)) {
1828
+            if (!$newMethod && $this->ffprobe->isValid($fileLocation)) {
1829 1829
                 try {
1830 1830
                     $video = $this->ffmpeg->open($fileLocation);
1831 1831
                     $videoSample = $video->clip(TimeCode::fromSeconds(0), TimeCode::fromSeconds($this->_ffMPEGDuration));
@@ -1848,14 +1848,14 @@  discard block
 block discarded – undo
1848 1848
 
1849 1849
                 // Try to move the file to the new path.
1850 1850
                 // If we couldn't rename it, try to copy it.
1851
-                if (! @File::move($fileName, $newFile)) {
1851
+                if (!@File::move($fileName, $newFile)) {
1852 1852
                     $copied = @File::copy($fileName, $newFile);
1853 1853
 
1854 1854
                     // Delete the old file.
1855 1855
                     File::delete($fileName);
1856 1856
 
1857 1857
                     // If it didn't copy, continue.
1858
-                    if (! $copied) {
1858
+                    if (!$copied) {
1859 1859
                         return false;
1860 1860
                     }
1861 1861
                 }
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
      */
1882 1882
     protected function _getMediaInfo($fileLocation): bool
1883 1883
     {
1884
-        if (! $this->_processMediaInfo) {
1884
+        if (!$this->_processMediaInfo) {
1885 1885
             return false;
1886 1886
         }
1887 1887
 
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
         $filesAdded = 0;
1957 1957
 
1958 1958
         foreach ($this->_par2Info->getFileList() as $file) {
1959
-            if (! isset($file['name'])) {
1959
+            if (!isset($file['name'])) {
1960 1960
                 continue;
1961 1961
             }
1962 1962
 
@@ -1979,7 +1979,7 @@  discard block
 block discarded – undo
1979 1979
             }
1980 1980
 
1981 1981
             // Try to get a new name.
1982
-            if (! $foundName) {
1982
+            if (!$foundName) {
1983 1983
                 $this->_release->textstring = $file['name'];
1984 1984
                 $this->_release->releases_id = $this->_release->id;
1985 1985
                 if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI, 'PAR2, ', 1, 1)) {
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
     protected function _processVideoFile($fileLocation): void
2010 2010
     {
2011 2011
         // Try to get a sample with it.
2012
-        if (! $this->_foundSample) {
2012
+        if (!$this->_foundSample) {
2013 2013
             $this->_foundSample = $this->_getSample($fileLocation);
2014 2014
         }
2015 2015
 
@@ -2017,12 +2017,12 @@  discard block
 block discarded – undo
2017 2017
          * Don't get it here if _sampleMessageIDs is empty
2018 2018
          * or has 1 message-id (Saves downloading another part).
2019 2019
          */
2020
-        if (! $this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
2020
+        if (!$this->_foundVideo && \count($this->_sampleMessageIDs) < 2) {
2021 2021
             $this->_foundVideo = $this->_getVideo($fileLocation);
2022 2022
         }
2023 2023
 
2024 2024
         // Try to get media info with it.
2025
-        if (! $this->_foundMediaInfo) {
2025
+        if (!$this->_foundMediaInfo) {
2026 2026
             $this->_foundMediaInfo = $this->_getMediaInfo($fileLocation);
2027 2027
         }
2028 2028
     }
@@ -2044,24 +2044,24 @@  discard block
 block discarded – undo
2044 2044
             $bf = true;
2045 2045
         }
2046 2046
 
2047
-        if (! $af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2047
+        if (!$af && preg_match('/\.rar($|[ ")\]-])/i', $a)) {
2048 2048
             $a = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $a);
2049 2049
             $af = true;
2050 2050
         }
2051
-        if (! $bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2051
+        if (!$bf && preg_match('/\.rar($|[ ")\]-])/i', $b)) {
2052 2052
             $b = preg_replace('/\.rar(?:$|[ ")\]-])/i', '.*rar', $b);
2053 2053
             $bf = true;
2054 2054
         }
2055 2055
 
2056
-        if (! $af && ! $bf) {
2056
+        if (!$af && !$bf) {
2057 2057
             return strnatcasecmp($a, $b);
2058 2058
         }
2059 2059
 
2060
-        if (! $bf) {
2060
+        if (!$bf) {
2061 2061
             return -1;
2062 2062
         }
2063 2063
 
2064
-        if (! $af) {
2064
+        if (!$af) {
2065 2065
             return 1;
2066 2066
         }
2067 2067
 
@@ -2086,12 +2086,12 @@  discard block
 block discarded – undo
2086 2086
     protected function _resetReleaseStatus(): void
2087 2087
     {
2088 2088
         // Only process for samples, previews and images if not disabled.
2089
-        $this->_foundVideo = ! $this->_processVideo;
2090
-        $this->_foundMediaInfo = ! $this->_processMediaInfo;
2091
-        $this->_foundAudioInfo = ! $this->_processAudioInfo;
2092
-        $this->_foundAudioSample = ! $this->_processAudioSample;
2093
-        $this->_foundJPGSample = ! $this->_processJPGSample;
2094
-        $this->_foundSample = ! $this->_processThumbnails;
2089
+        $this->_foundVideo = !$this->_processVideo;
2090
+        $this->_foundMediaInfo = !$this->_processMediaInfo;
2091
+        $this->_foundAudioInfo = !$this->_processAudioInfo;
2092
+        $this->_foundAudioSample = !$this->_processAudioSample;
2093
+        $this->_foundJPGSample = !$this->_processJPGSample;
2094
+        $this->_foundSample = !$this->_processThumbnails;
2095 2095
         $this->_foundPAR2Info = false;
2096 2096
 
2097 2097
         $this->_passwordStatus = Releases::PASSWD_NONE;
Please login to merge, or discard this patch.