Passed
Push — master ( 3ad86d...6a210c )
by MusikAnimal
07:27
created
src/AppBundle/Model/EditCounter.php 1 patch
Spacing   +23 added lines, -23 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,9 +633,9 @@  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-a']) ? $logCounts['review-approve-a'] : 0) +
638
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
636
+        $total = $logCounts['review-approve']+
637
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
638
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
639 639
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
640 640
         return $total;
641 641
     }
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
         $logCounts = $this->getLogCounts();
660 660
         $create2 = $logCounts['newusers-create2'] ?: 0;
661 661
         $byemail = $logCounts['newusers-byemail'] ?: 0;
662
-        return $create2 + $byemail;
662
+        return $create2+$byemail;
663 663
     }
664 664
 
665 665
     /**
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 
742 742
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
743 743
         $out = [
744
-            'yearLabels' => [],  // labels for years
744
+            'yearLabels' => [], // labels for years
745 745
             'monthLabels' => [], // labels for months
746 746
             'totals' => [], // actual totals, grouped by namespace, year and then month
747 747
         ];
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
                 $out['totals'][$ns][$total['year']] = [];
836 836
             }
837 837
 
838
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
838
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
839 839
         }
840 840
 
841 841
         return [$out, $firstEdit];
@@ -852,9 +852,9 @@  discard block
 block discarded – undo
852 852
     private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange): array
853 853
     {
854 854
         foreach ($dateRange as $monthObj) {
855
-            $year = (int) $monthObj->format('Y');
855
+            $year = (int)$monthObj->format('Y');
856 856
             $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy');
857
-            $month = (int) $monthObj->format('n');
857
+            $month = (int)$monthObj->format('n');
858 858
             $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM');
859 859
 
860 860
             // Fill in labels
@@ -1024,8 +1024,8 @@  discard block
 block discarded – undo
1024 1024
 
1025 1025
         if ($sorted) {
1026 1026
             // Sort.
1027
-            uasort($this->globalEditCounts, function ($a, $b) {
1028
-                return $b['total'] - $a['total'];
1027
+            uasort($this->globalEditCounts, function($a, $b) {
1028
+                return $b['total']-$a['total'];
1029 1029
             });
1030 1030
         }
1031 1031
 
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
     public function countSmallEdits(): int
1120 1120
     {
1121 1121
         $editSizeData = $this->getEditSizeData();
1122
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
1122
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
1123 1123
     }
1124 1124
 
1125 1125
     /**
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
     public function countLargeEdits(): int
1130 1130
     {
1131 1131
         $editSizeData = $this->getEditSizeData();
1132
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
1132
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
1133 1133
     }
1134 1134
 
1135 1135
     /**
Please login to merge, or discard this patch.