Passed
Push — master ( b25a2f...9287df )
by MusikAnimal
06:36
created
src/AppBundle/Model/EditCounter.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the EditCounter class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
         // Filter out unblocks unless requested.
139 139
         if ($blocksOnly) {
140
-            $blocks = array_filter($blocks, function ($block) {
140
+            $blocks = array_filter($blocks, function($block) {
141 141
                 return 'block' === $block['log_action'];
142 142
             });
143 143
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function countAllRevisions(): int
173 173
     {
174
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
174
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
175 175
     }
176 176
 
177 177
     /**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function countAllPagesEdited(): int
212 212
     {
213
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
213
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
214 214
     }
215 215
 
216 216
     /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function countPagesCreated(): int
222 222
     {
223
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
223
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
224 224
     }
225 225
 
226 226
     /**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             } elseif ('unblock' === $block['log_action']) {
361 361
                 // The last block was lifted. So the duration will be the time from when the
362 362
                 // last block was set to the time of the unblock.
363
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
363
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
364 364
                 if ($timeSinceLastBlock > $this->longestBlockSeconds) {
365 365
                     $this->longestBlockSeconds = $timeSinceLastBlock;
366 366
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
                 // The last block was modified. So we will adjust $lastBlock to include
372 372
                 // the difference of the duration of the new reblock, and time since the last block.
373 373
                 // $lastBlock is left unchanged if its duration was indefinite.
374
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
375
-                $lastBlock[1] = $timeSinceLastBlock + $duration;
374
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
375
+                $lastBlock[1] = $timeSinceLastBlock+$duration;
376 376
             }
377 377
         }
378 378
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         }
383 383
 
384 384
         // Test if the last block is still active, and if so use the expiry as the duration.
385
-        $lastBlockExpiry = $lastBlock[0] + $lastBlock[1];
385
+        $lastBlockExpiry = $lastBlock[0]+$lastBlock[1];
386 386
         if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) {
387 387
             $this->longestBlockSeconds = $lastBlock[1];
388 388
         // Otherwise, test if the duration of the last block is now the longest overall.
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         // If invalid, $duration is left as null.
427 427
         if (strtotime($durationStr)) {
428 428
             $expiry = strtotime($durationStr, $timestamp);
429
-            $duration = $expiry - $timestamp;
429
+            $duration = $expiry-$timestamp;
430 430
         }
431 431
 
432 432
         return [$timestamp, $duration];
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
514 514
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
515 515
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
516
-        return $import + $interwiki + $upload;
516
+        return $import+$interwiki+$upload;
517 517
     }
518 518
 
519 519
     public function countAbuseFilterchanges(): int
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
     public function approvals(): int
634 634
     {
635 635
         $logCounts = $this->getLogCounts();
636
-        $total = $logCounts['review-approve'] +
637
-            (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0) +
638
-            (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0) +
639
-            (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
636
+        $total = $logCounts['review-approve']+
637
+            (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0)+
638
+            (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0)+
639
+            (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
640 640
             (!empty($logCounts['review-approve2-i']) ? $logCounts['review2-approve-i'] : 0);
641 641
         return $total;
642 642
     }
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
         $logCounts = $this->getLogCounts();
661 661
         $create2 = $logCounts['newusers-create2'] ?: 0;
662 662
         $byemail = $logCounts['newusers-byemail'] ?: 0;
663
-        return $create2 + $byemail;
663
+        return $create2+$byemail;
664 664
     }
665 665
 
666 666
     /**
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 
763 763
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
764 764
         $out = [
765
-            'yearLabels' => [],  // labels for years
765
+            'yearLabels' => [], // labels for years
766 766
             'monthLabels' => [], // labels for months
767 767
             'totals' => [], // actual totals, grouped by namespace, year and then month
768 768
         ];
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
                 $out['totals'][$ns][$total['year']] = [];
857 857
             }
858 858
 
859
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
859
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
860 860
         }
861 861
 
862 862
         return [$out, $firstEdit];
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
     private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange): array
874 874
     {
875 875
         foreach ($dateRange as $monthObj) {
876
-            $year = (int) $monthObj->format('Y');
876
+            $year = (int)$monthObj->format('Y');
877 877
             $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy');
878
-            $month = (int) $monthObj->format('n');
878
+            $month = (int)$monthObj->format('n');
879 879
             $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM');
880 880
 
881 881
             // Fill in labels
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
         if ($sorted) {
1047 1047
             // Sort.
1048
-            uasort($this->globalEditCounts, function ($a, $b) {
1049
-                return $b['total'] - $a['total'];
1048
+            uasort($this->globalEditCounts, function($a, $b) {
1049
+                return $b['total']-$a['total'];
1050 1050
             });
1051 1051
         }
1052 1052
 
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
         // Registered accounts; for these we go by globalEditCounts() which uses CentralAuth.
1067 1067
         $projects = [];
1068
-        $globalCounts = array_column(array_filter($this->globalEditCounts(), function ($row) {
1068
+        $globalCounts = array_column(array_filter($this->globalEditCounts(), function($row) {
1069 1069
             return $row['total'] > 0;
1070 1070
         }), 'project');
1071 1071
         foreach ($globalCounts as $globalCount) {
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
     public function countSmallEdits(): int
1154 1154
     {
1155 1155
         $editSizeData = $this->getEditSizeData();
1156
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
1156
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
1157 1157
     }
1158 1158
 
1159 1159
     /**
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
     public function countLargeEdits(): int
1164 1164
     {
1165 1165
         $editSizeData = $this->getEditSizeData();
1166
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
1166
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
1167 1167
     }
1168 1168
 
1169 1169
     /**
Please login to merge, or discard this patch.