Completed
Push — master ( c51827...601203 )
by Sam
02:51
created
src/Xtools/EditCounter.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     protected function getRevisionCounts()
56 56
     {
57
-        if (! is_array($this->revisionCounts)) {
57
+        if (!is_array($this->revisionCounts)) {
58 58
             $this->revisionCounts = $this->getRepository()
59 59
                 ->getRevisionCounts($this->project, $this->user);
60 60
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function getRevisionDates()
69 69
     {
70
-        if (! is_array($this->revisionDates)) {
70
+        if (!is_array($this->revisionDates)) {
71 71
             $this->revisionDates = $this->getRepository()
72 72
                 ->getRevisionDates($this->project, $this->user);
73 73
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function getPageCounts()
82 82
     {
83
-        if (! is_array($this->pageCounts)) {
83
+        if (!is_array($this->pageCounts)) {
84 84
             $this->pageCounts = $this->getRepository()
85 85
                 ->getPageCounts($this->project, $this->user);
86 86
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     protected function getLogCounts()
95 95
     {
96
-        if (! is_array($this->logCounts)) {
96
+        if (!is_array($this->logCounts)) {
97 97
             $this->logCounts = $this->getRepository()
98 98
                 ->getLogCounts($this->project, $this->user);
99 99
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function countAllRevisions()
144 144
     {
145
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
145
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
146 146
     }
147 147
 
148 148
     /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function countRevisionsWithoutComments()
163 163
     {
164
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
164
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
165 165
     }
166 166
 
167 167
     /**
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function countAllPagesEdited()
230 230
     {
231
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
231
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
232 232
     }
233 233
 
234 234
     /**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function countPagesCreated()
240 240
     {
241
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
241
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
242 242
     }
243 243
 
244 244
     /**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         $logCounts = $this->getLogCounts();
291 291
         $block = isset($logCounts['block-block']) ? (int)$logCounts['block-block'] : 0;
292 292
         $reBlock = isset($logCounts['block-reblock']) ? (int)$logCounts['block-reblock'] : 0;
293
-        return $block + $reBlock;
293
+        return $block+$reBlock;
294 294
     }
295 295
 
296 296
     /**
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
     public function approvals()
518 518
     {
519 519
         $logCounts = $this->getLogCounts();
520
-        $total = $logCounts['review-approve'] +
521
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
522
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
520
+        $total = $logCounts['review-approve']+
521
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
522
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
523 523
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
524 524
         return $total;
525 525
     }
@@ -601,14 +601,14 @@  discard block
 block discarded – undo
601 601
             if (!isset($out['totals'][$ns])) {
602 602
                 $out['totals'][$ns] = [];
603 603
             }
604
-            $out['totals'][$ns][$total['year'] . $total['month']] = $total['count'];
604
+            $out['totals'][$ns][$total['year'].$total['month']] = $total['count'];
605 605
         }
606 606
         // Fill in the blanks (where no edits were made in a given month for a namespace).
607 607
         for ($y = $out['min_year']; $y <= $out['max_year']; $y++) {
608 608
             for ($m = 1; $m <= 12; $m++) {
609 609
                 foreach ($out['totals'] as $nsId => &$total) {
610
-                    if (!isset($total[$y . $m])) {
611
-                        $total[$y . $m] = 0;
610
+                    if (!isset($total[$y.$m])) {
611
+                        $total[$y.$m] = 0;
612 612
                     }
613 613
                 }
614 614
             }
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
         // Get counts.
627 627
         $editCounts = $this->globalEditCounts();
628 628
         // Sort.
629
-        uasort($editCounts, function ($a, $b) {
630
-            return $b['total'] - $a['total'];
629
+        uasort($editCounts, function($a, $b) {
630
+            return $b['total']-$a['total'];
631 631
         });
632 632
         // Truncate, and return.
633 633
         return array_slice($editCounts, 0, $numProjects);
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
             foreach ($revisions as &$revision) {
684 684
                 $nsName = $otherProject->getNamespaces()[$revision['page_namespace']];
685 685
                 $page = $otherProject->getRepository()
686
-                    ->getPage($otherProject, $nsName . ':' . $revision['page_title']);
686
+                    ->getPage($otherProject, $nsName.':'.$revision['page_title']);
687 687
                 $edit = new Edit($page, $revision);
688 688
 
689 689
                 // If we've already got enough, only check for those newer than the current oldest.
Please login to merge, or discard this patch.