Completed
Pull Request — master (#66)
by MusikAnimal
02:55
created
src/Xtools/EditCounter.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -622,6 +622,7 @@
 block discarded – undo
622 622
      * Get the total numbers of edits per month.
623 623
      * @param null|DateTime [$currentTime] - *USED ONLY FOR UNIT TESTING*
624 624
      *   so we can mock the current DateTime
625
+     * @param DateTime $currentTime
625 626
      * @return mixed[] With keys 'years', 'namespaces' and 'totals'.
626 627
      */
627 628
     public function monthCounts($currentTime = null)
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     protected function getPairData()
77 77
     {
78
-        if (! is_array($this->pairData)) {
78
+        if (!is_array($this->pairData)) {
79 79
             $this->pairData = $this->getRepository()
80 80
                 ->getPairData($this->project, $this->user);
81 81
         }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function getLogCounts()
90 90
     {
91
-        if (! is_array($this->logCounts)) {
91
+        if (!is_array($this->logCounts)) {
92 92
             $this->logCounts = $this->getRepository()
93 93
                 ->getLogCounts($this->project, $this->user);
94 94
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function countAllRevisions()
139 139
     {
140
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
140
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
141 141
     }
142 142
 
143 143
     /**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function countRevisionsWithoutComments()
158 158
     {
159
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
159
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
160 160
     }
161 161
 
162 162
     /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function countAllPagesEdited()
197 197
     {
198
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
198
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
199 199
     }
200 200
 
201 201
     /**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function countPagesCreated()
207 207
     {
208
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
208
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
209 209
     }
210 210
 
211 211
     /**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             // Try block just in case there are older, unpredictable formats
334 334
             try {
335 335
                 $expiry = strtotime($durationStr, $timestamp);
336
-                $duration = ($expiry - $timestamp) / (60 * 60 * 24);
336
+                $duration = ($expiry-$timestamp) / (60 * 60 * 24);
337 337
 
338 338
                 if (!$duration || $duration > $this->longestBlockDays) {
339 339
                     $this->longestBlockDays = $duration;
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
418 418
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
419 419
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
420
-        return $import + $interwiki + $upload;
420
+        return $import+$interwiki+$upload;
421 421
     }
422 422
 
423 423
     /**
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
     public function approvals()
542 542
     {
543 543
         $logCounts = $this->getLogCounts();
544
-        $total = $logCounts['review-approve'] +
545
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
546
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
544
+        $total = $logCounts['review-approve']+
545
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
546
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
547 547
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
548 548
         return $total;
549 549
     }
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
         $logCounts = $this->getLogCounts();
568 568
         $create2 = $logCounts['newusers-create2'] ?: 0;
569 569
         $byemail = $logCounts['newusers-byemail'] ?: 0;
570
-        return $create2 + $byemail;
570
+        return $create2+$byemail;
571 571
     }
572 572
 
573 573
     /**
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
                 $out['totals'][$ns] = [];
657 657
             }
658 658
 
659
-            $out['totals'][$ns][$total['year'] . $total['month']] = (int) $total['count'];
659
+            $out['totals'][$ns][$total['year'].$total['month']] = (int)$total['count'];
660 660
         }
661 661
 
662 662
         $interval = new DateInterval('P1M');
@@ -738,8 +738,8 @@  discard block
 block discarded – undo
738 738
                 ->globalEditCounts($this->user, $this->project);
739 739
             if ($sorted) {
740 740
                 // Sort.
741
-                uasort($this->globalEditCounts, function ($a, $b) {
742
-                    return $b['total'] - $a['total'];
741
+                uasort($this->globalEditCounts, function($a, $b) {
742
+                    return $b['total']-$a['total'];
743 743
                 });
744 744
             }
745 745
         }
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
778 778
             }
779 779
             $page = $project->getRepository()
780
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
780
+                ->getPage($project, $nsName.':'.$revision['page_title']);
781 781
             $edit = new Edit($page, $revision);
782 782
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
783 783
         }
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
      */
795 795
     protected function getEditSizeData()
796 796
     {
797
-        if (! is_array($this->editSizeData)) {
797
+        if (!is_array($this->editSizeData)) {
798 798
             $this->editSizeData = $this->getRepository()
799 799
                 ->getEditSizeData($this->project, $this->user);
800 800
         }
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
     public function countSmallEdits()
819 819
     {
820 820
         $editSizeData = $this->getEditSizeData();
821
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
821
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
822 822
     }
823 823
 
824 824
     /**
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
     public function countLargeEdits()
829 829
     {
830 830
         $editSizeData = $this->getEditSizeData();
831
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
831
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
832 832
     }
833 833
 
834 834
     /**
Please login to merge, or discard this patch.