Passed
Push — master ( 111f61...587f2b )
by MusikAnimal
06:11
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
     /**
@@ -627,9 +627,9 @@  discard block
 block discarded – undo
627 627
     public function approvals(): int
628 628
     {
629 629
         $logCounts = $this->getLogCounts();
630
-        $total = $logCounts['review-approve'] +
631
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
632
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
630
+        $total = $logCounts['review-approve']+
631
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
632
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
633 633
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
634 634
         return $total;
635 635
     }
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
         $logCounts = $this->getLogCounts();
654 654
         $create2 = $logCounts['newusers-create2'] ?: 0;
655 655
         $byemail = $logCounts['newusers-byemail'] ?: 0;
656
-        return $create2 + $byemail;
656
+        return $create2+$byemail;
657 657
     }
658 658
 
659 659
     /**
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 
736 736
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
737 737
         $out = [
738
-            'yearLabels' => [],  // labels for years
738
+            'yearLabels' => [], // labels for years
739 739
             'monthLabels' => [], // labels for months
740 740
             'totals' => [], // actual totals, grouped by namespace, year and then month
741 741
         ];
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
                 $out['totals'][$ns][$total['year']] = [];
830 830
             }
831 831
 
832
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
832
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
833 833
         }
834 834
 
835 835
         return [$out, $firstEdit];
@@ -846,9 +846,9 @@  discard block
 block discarded – undo
846 846
     private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange): array
847 847
     {
848 848
         foreach ($dateRange as $monthObj) {
849
-            $year = (int) $monthObj->format('Y');
849
+            $year = (int)$monthObj->format('Y');
850 850
             $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy');
851
-            $month = (int) $monthObj->format('n');
851
+            $month = (int)$monthObj->format('n');
852 852
             $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM');
853 853
 
854 854
             // Fill in labels
@@ -1018,8 +1018,8 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
         if ($sorted) {
1020 1020
             // Sort.
1021
-            uasort($this->globalEditCounts, function ($a, $b) {
1022
-                return $b['total'] - $a['total'];
1021
+            uasort($this->globalEditCounts, function($a, $b) {
1022
+                return $b['total']-$a['total'];
1023 1023
             });
1024 1024
         }
1025 1025
 
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
     public function countSmallEdits(): int
1109 1109
     {
1110 1110
         $editSizeData = $this->getEditSizeData();
1111
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
1111
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
1112 1112
     }
1113 1113
 
1114 1114
     /**
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
     public function countLargeEdits(): int
1119 1119
     {
1120 1120
         $editSizeData = $this->getEditSizeData();
1121
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
1121
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
1122 1122
     }
1123 1123
 
1124 1124
     /**
Please login to merge, or discard this patch.