Completed
Pull Request — master (#66)
by MusikAnimal
02:53
created
src/Xtools/EditCounter.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     protected function getPairData()
74 74
     {
75
-        if (! is_array($this->pairData)) {
75
+        if (!is_array($this->pairData)) {
76 76
             $this->pairData = $this->getRepository()
77 77
                 ->getPairData($this->project, $this->user);
78 78
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     protected function getLogCounts()
87 87
     {
88
-        if (! is_array($this->logCounts)) {
88
+        if (!is_array($this->logCounts)) {
89 89
             $this->logCounts = $this->getRepository()
90 90
                 ->getLogCounts($this->project, $this->user);
91 91
         }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function countAllRevisions()
136 136
     {
137
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
137
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
138 138
     }
139 139
 
140 140
     /**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public function countRevisionsWithoutComments()
155 155
     {
156
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
156
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
157 157
     }
158 158
 
159 159
     /**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function countAllPagesEdited()
194 194
     {
195
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
195
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
196 196
     }
197 197
 
198 198
     /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function countPagesCreated()
204 204
     {
205
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
205
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
206 206
     }
207 207
 
208 208
     /**
@@ -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;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
415 415
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
416 416
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
417
-        return $import + $interwiki + $upload;
417
+        return $import+$interwiki+$upload;
418 418
     }
419 419
 
420 420
     /**
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
     public function approvals()
539 539
     {
540 540
         $logCounts = $this->getLogCounts();
541
-        $total = $logCounts['review-approve'] +
542
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
543
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
541
+        $total = $logCounts['review-approve']+
542
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
543
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
544 544
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
545 545
         return $total;
546 546
     }
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
         $logCounts = $this->getLogCounts();
565 565
         $create2 = $logCounts['newusers-create2'] ?: 0;
566 566
         $byemail = $logCounts['newusers-byemail'] ?: 0;
567
-        return $create2 + $byemail;
567
+        return $create2+$byemail;
568 568
     }
569 569
 
570 570
     /**
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
                 $out['totals'][$ns] = [];
643 643
             }
644 644
 
645
-            $out['totals'][$ns][$total['year'] . $total['month']] = $total['count'];
645
+            $out['totals'][$ns][$total['year'].$total['month']] = $total['count'];
646 646
         }
647 647
 
648 648
         $interval = new DateInterval('P1M');
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
                 ->globalEditCounts($this->user, $this->project);
724 724
             if ($sorted) {
725 725
                 // Sort.
726
-                uasort($this->globalEditCounts, function ($a, $b) {
727
-                    return $b['total'] - $a['total'];
726
+                uasort($this->globalEditCounts, function($a, $b) {
727
+                    return $b['total']-$a['total'];
728 728
                 });
729 729
             }
730 730
         }
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
763 763
             }
764 764
             $page = $project->getRepository()
765
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
765
+                ->getPage($project, $nsName.':'.$revision['page_title']);
766 766
             $edit = new Edit($page, $revision);
767 767
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
768 768
         }
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
      */
780 780
     protected function getEditSizeData()
781 781
     {
782
-        if (! is_array($this->editSizeData)) {
782
+        if (!is_array($this->editSizeData)) {
783 783
             $this->editSizeData = $this->getRepository()
784 784
                 ->getEditSizeData($this->project, $this->user);
785 785
         }
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
     public function countSmallEdits()
804 804
     {
805 805
         $editSizeData = $this->getEditSizeData();
806
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
806
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
807 807
     }
808 808
 
809 809
     /**
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
     public function countLargeEdits()
814 814
     {
815 815
         $editSizeData = $this->getEditSizeData();
816
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
816
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
817 817
     }
818 818
 
819 819
     /**
Please login to merge, or discard this patch.