Completed
Push — master ( 1cfc3c...d2bafa )
by Sam
02:57
created
src/Xtools/EditCounter.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     protected function getPairData()
63 63
     {
64
-        if (! is_array($this->pairData)) {
64
+        if (!is_array($this->pairData)) {
65 65
             $this->pairData = $this->getRepository()
66 66
                 ->getPairData($this->project, $this->user);
67 67
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function getLogCounts()
76 76
     {
77
-        if (! is_array($this->logCounts)) {
77
+        if (!is_array($this->logCounts)) {
78 78
             $this->logCounts = $this->getRepository()
79 79
                 ->getLogCounts($this->project, $this->user);
80 80
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function countAllRevisions()
125 125
     {
126
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
126
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
127 127
     }
128 128
 
129 129
     /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function countRevisionsWithoutComments()
144 144
     {
145
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
145
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
146 146
     }
147 147
 
148 148
     /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function countAllPagesEdited()
214 214
     {
215
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
215
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
216 216
     }
217 217
 
218 218
     /**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function countPagesCreated()
224 224
     {
225
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
225
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
226 226
     }
227 227
 
228 228
     /**
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $logCounts = $this->getLogCounts();
275 275
         $block = isset($logCounts['block-block']) ? (int)$logCounts['block-block'] : 0;
276 276
         $reBlock = isset($logCounts['block-reblock']) ? (int)$logCounts['block-reblock'] : 0;
277
-        return $block + $reBlock;
277
+        return $block+$reBlock;
278 278
     }
279 279
 
280 280
     /**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             // Try block just in case there are older, unpredictable formats
331 331
             try {
332 332
                 $expiry = strtotime($durationStr, $timestamp);
333
-                $duration = ($expiry - $timestamp) / (60 * 60 * 24);
333
+                $duration = ($expiry-$timestamp) / (60 * 60 * 24);
334 334
 
335 335
                 if (!$duration || $duration > $this->longestBlockDays) {
336 336
                     $this->longestBlockDays = $duration;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
419 419
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
420 420
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
421
-        return $import + $interwiki + $upload;
421
+        return $import+$interwiki+$upload;
422 422
     }
423 423
 
424 424
     /**
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
     public function approvals()
552 552
     {
553 553
         $logCounts = $this->getLogCounts();
554
-        $total = $logCounts['review-approve'] +
555
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
556
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
554
+        $total = $logCounts['review-approve']+
555
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
556
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
557 557
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
558 558
         return $total;
559 559
     }
@@ -635,14 +635,14 @@  discard block
 block discarded – undo
635 635
             if (!isset($out['totals'][$ns])) {
636 636
                 $out['totals'][$ns] = [];
637 637
             }
638
-            $out['totals'][$ns][$total['year'] . $total['month']] = $total['count'];
638
+            $out['totals'][$ns][$total['year'].$total['month']] = $total['count'];
639 639
         }
640 640
         // Fill in the blanks (where no edits were made in a given month for a namespace).
641 641
         for ($y = $out['min_year']; $y <= $out['max_year']; $y++) {
642 642
             for ($m = 1; $m <= 12; $m++) {
643 643
                 foreach ($out['totals'] as $nsId => &$total) {
644
-                    if (!isset($total[$y . $m])) {
645
-                        $total[$y . $m] = 0;
644
+                    if (!isset($total[$y.$m])) {
645
+                        $total[$y.$m] = 0;
646 646
                     }
647 647
                 }
648 648
             }
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
                 ->globalEditCounts($this->user, $this->project);
705 705
             if ($sorted) {
706 706
                 // Sort.
707
-                uasort($this->globalEditCounts, function ($a, $b) {
708
-                    return $b['total'] - $a['total'];
707
+                uasort($this->globalEditCounts, function($a, $b) {
708
+                    return $b['total']-$a['total'];
709 709
                 });
710 710
             }
711 711
         }
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
744 744
             }
745 745
             $page = $project->getRepository()
746
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
746
+                ->getPage($project, $nsName.':'.$revision['page_title']);
747 747
             $edit = new Edit($page, $revision);
748 748
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
749 749
         }
Please login to merge, or discard this patch.