Passed
Push — master ( af4942...3afb16 )
by Darko
06:37
created
Blacklight/Binaries.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 
378 378
             $done = false;
379 379
             // Get all the parts (in portions of $this->messageBuffer to not use too much memory).
380
-            while (! $done) {
380
+            while (!$done) {
381 381
                 // Increment last until we reach $groupLast (group newest article).
382 382
                 if ($total > $this->messageBuffer) {
383 383
                     if ((string) ($first + $this->messageBuffer) > $groupLast) {
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                 $scanSummary = $this->scan($groupMySQL, $first, $last);
402 402
 
403 403
                 // Check if we fetched headers.
404
-                if (! empty($scanSummary)) {
404
+                if (!empty($scanSummary)) {
405 405
                     // If new group, update first record & postdate
406 406
                     if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] === 0) {
407 407
                         $groupMySQL['first_record'] = $scanSummary['firstArticleNumber'];
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
                     }
426 426
 
427 427
                     $scanSummary['lastArticleDate'] = (isset($scanSummary['lastArticleDate']) ? strtotime($scanSummary['lastArticleDate']) : false);
428
-                    if (! is_numeric($scanSummary['lastArticleDate'])) {
428
+                    if (!is_numeric($scanSummary['lastArticleDate'])) {
429 429
                         $scanSummary['lastArticleDate'] = $this->postdate($scanSummary['lastArticleNumber'], $groupNNTP);
430 430
                     }
431 431
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
             // If set we are running in partRepair mode.
576 576
             if ($partRepair && $missingParts !== null) {
577
-                if (! \in_array($header['Number'], $missingParts, false)) {
577
+                if (!\in_array($header['Number'], $missingParts, false)) {
578 578
                     // If article isn't one that is missing skip it.
579 579
                     continue;
580 580
                 }
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 
620 620
         unset($headers); // Reclaim memory now that headers are split.
621 621
 
622
-        if (! empty($this->_binaryBlacklistIdsToUpdate)) {
622
+        if (!empty($this->_binaryBlacklistIdsToUpdate)) {
623 623
             $this->updateBlacklistUsage();
624 624
         }
625 625
 
626
-        if ($this->_echoCLI && ! $partRepair) {
626
+        if ($this->_echoCLI && !$partRepair) {
627 627
             $this->outputHeaderInitial();
628 628
         }
629 629
 
630
-        if (! empty($stdHeaders)) {
630
+        if (!empty($stdHeaders)) {
631 631
             $this->storeHeaders($stdHeaders);
632 632
         }
633 633
         unset($stdHeaders);
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
         // Loop articles, figure out files/parts.
703 703
         foreach ($headers as $this->header) {
704 704
             // Set up the info for inserting into parts/binaries/collections tables.
705
-            if (! isset($articles[$this->header['matches'][1]])) {
705
+            if (!isset($articles[$this->header['matches'][1]])) {
706 706
                 // Attempt to find the file count. If it is not found, set it to 0.
707 707
                 $fileCount = $this->getFileCount($this->header['matches'][1]);
708 708
                 if ($fileCount[1] === 0 && $fileCount[3] === 0) {
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
                 $this->header['CollectionKey'] = $collMatch['name'].$fileCount[3];
718 718
 
719 719
                 // If this header's collection key isn't in memory, attempt to insert the collection
720
-                if (! isset($collectionIDs[$this->header['CollectionKey']])) {
720
+                if (!isset($collectionIDs[$this->header['CollectionKey']])) {
721 721
                     /* Date from header should be a string this format:
722 722
                      * 31 Mar 2014 15:36:04 GMT or 6 Oct 1998 04:38:40 -0500
723 723
                      * Still make sure it's not unix time, convert it to unix time if it is.
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 
749 749
                     $finalXrefArray = [];
750 750
                     foreach ($tempHeaderXrefs as $tempHeaderXref) {
751
-                        if (! in_array($tempHeaderXref, $tempXrefsData, false)) {
751
+                        if (!in_array($tempHeaderXref, $tempXrefsData, false)) {
752 752
                             $finalXrefArray[] = $tempHeaderXref;
753 753
                         }
754 754
                     }
@@ -888,12 +888,12 @@  discard block
 block discarded – undo
888 888
         $iterator1 = 0;
889 889
         $iterator2 = $msgCount - 1;
890 890
         while (true) {
891
-            if (! isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) {
891
+            if (!isset($returnArray['firstArticleNumber']) && isset($headers[$iterator1]['Number'])) {
892 892
                 $returnArray['firstArticleNumber'] = $headers[$iterator1]['Number'];
893 893
                 $returnArray['firstArticleDate'] = $headers[$iterator1]['Date'];
894 894
             }
895 895
 
896
-            if (! isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) {
896
+            if (!isset($returnArray['lastArticleNumber']) && isset($headers[$iterator2]['Number'])) {
897 897
                 $returnArray['lastArticleNumber'] = $headers[$iterator2]['Number'];
898 898
                 $returnArray['lastArticleDate'] = $headers[$iterator2]['Date'];
899 899
             }
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
         }
1068 1068
 
1069 1069
         // Remove articles that we cant fetch after x attempts.
1070
-        DB::transaction(function () use ($groupArr) {
1070
+        DB::transaction(function() use ($groupArr) {
1071 1071
             DB::delete(
1072 1072
                 sprintf(
1073 1073
                     'DELETE FROM missed_parts WHERE attempts >= %d AND groups_id = %d',
@@ -1106,14 +1106,14 @@  discard block
 block discarded – undo
1106 1106
                     $currentPost
1107 1107
                 )
1108 1108
             );
1109
-            if (! empty($local) && \count($local) > 0) {
1109
+            if (!empty($local) && \count($local) > 0) {
1110 1110
                 $date = $local[0]->date;
1111 1111
                 break;
1112 1112
             }
1113 1113
 
1114 1114
             // If we could not find it locally, try usenet.
1115 1115
             $header = $this->_nntp->getXOVER($currentPost);
1116
-            if (! $this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') {
1116
+            if (!$this->_nntp::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') {
1117 1117
                 $date = $header[0]['Date'];
1118 1118
                 break;
1119 1119
             }
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
         } while ($attempts++ <= 20);
1139 1139
 
1140 1140
         // If we didn't get a date, set it to now.
1141
-        if (! $date) {
1141
+        if (!$date) {
1142 1142
             $date = time();
1143 1143
         } else {
1144 1144
             $date = strtotime($date);
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
             $articleTime = $this->postdate($wantedArticle, $data);
1202 1202
 
1203 1203
             // Article doesn't exist, start again with something random
1204
-            if (! $articleTime) {
1204
+            if (!$articleTime) {
1205 1205
                 $wantedArticle = random_int($aMin, $aMax);
1206 1206
                 $articleTime = $this->postdate($wantedArticle, $data);
1207 1207
             }
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
         foreach ($numbers as $number) {
1274 1274
             $sql .= $number.',';
1275 1275
         }
1276
-        DB::transaction(static function () use ($groupID, $sql) {
1276
+        DB::transaction(static function() use ($groupID, $sql) {
1277 1277
             DB::delete(rtrim($sql, ',').') AND groups_id = '.$groupID);
1278 1278
         }, 10);
1279 1279
     }
@@ -1288,10 +1288,10 @@  discard block
 block discarded – undo
1288 1288
      */
1289 1289
     protected function _retrieveBlackList(string $groupName): void
1290 1290
     {
1291
-        if (! isset($this->blackList[$groupName])) {
1291
+        if (!isset($this->blackList[$groupName])) {
1292 1292
             $this->blackList[$groupName] = $this->getBlacklist(true, self::OPTYPE_BLACKLIST, $groupName, true);
1293 1293
         }
1294
-        if (! isset($this->whiteList[$groupName])) {
1294
+        if (!isset($this->whiteList[$groupName])) {
1295 1295
             $this->whiteList[$groupName] = $this->getBlacklist(true, self::OPTYPE_WHITELIST, $groupName, true);
1296 1296
         }
1297 1297
         $this->_listsFound[$groupName] = ($this->blackList[$groupName] || $this->whiteList[$groupName]);
@@ -1305,10 +1305,10 @@  discard block
 block discarded – undo
1305 1305
      */
1306 1306
     public function isBlackListed(array $msg, string $groupName): bool
1307 1307
     {
1308
-        if (! isset($this->_listsFound[$groupName])) {
1308
+        if (!isset($this->_listsFound[$groupName])) {
1309 1309
             $this->_retrieveBlackList($groupName);
1310 1310
         }
1311
-        if (! $this->_listsFound[$groupName]) {
1311
+        if (!$this->_listsFound[$groupName]) {
1312 1312
             return false;
1313 1313
         }
1314 1314
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 
1337 1337
         // Check if the field is blacklisted.
1338 1338
 
1339
-        if (! $blackListed && $this->blackList[$groupName]) {
1339
+        if (!$blackListed && $this->blackList[$groupName]) {
1340 1340
             foreach ($this->blackList[$groupName] as $blackList) {
1341 1341
                 if (preg_match('/'.$blackList->regex.'/i', $field[$blackList->msgcol])) {
1342 1342
                     $blackListed = true;
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
      */
1447 1447
     public function delete(int $collectionID): void
1448 1448
     {
1449
-        DB::transaction(static function () use ($collectionID) {
1449
+        DB::transaction(static function() use ($collectionID) {
1450 1450
             DB::delete(sprintf('DELETE FROM collections WHERE id = %d', $collectionID));
1451 1451
         }, 10);
1452 1452
 
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 
1494 1494
     private function getFileCount($subject): array
1495 1495
     {
1496
-        if (! preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) {
1496
+        if (!preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $subject, $fileCount)) {
1497 1497
             $fileCount[1] = $fileCount[3] = 0;
1498 1498
         }
1499 1499
 
Please login to merge, or discard this patch.