Completed
Push — master ( cf9a22...944927 )
by Sam
06:52
created
src/Xtools/EditCounter.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function getPairData()
69 69
     {
70
-        if (! is_array($this->pairData)) {
70
+        if (!is_array($this->pairData)) {
71 71
             $this->pairData = $this->getRepository()
72 72
                 ->getPairData($this->project, $this->user);
73 73
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function getLogCounts()
82 82
     {
83
-        if (! is_array($this->logCounts)) {
83
+        if (!is_array($this->logCounts)) {
84 84
             $this->logCounts = $this->getRepository()
85 85
                 ->getLogCounts($this->project, $this->user);
86 86
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function countAllRevisions()
131 131
     {
132
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
132
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
133 133
     }
134 134
 
135 135
     /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function countRevisionsWithoutComments()
150 150
     {
151
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
151
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
152 152
     }
153 153
 
154 154
     /**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function countAllPagesEdited()
189 189
     {
190
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
190
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
191 191
     }
192 192
 
193 193
     /**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function countPagesCreated()
199 199
     {
200
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
200
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
201 201
     }
202 202
 
203 203
     /**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             // Try block just in case there are older, unpredictable formats
326 326
             try {
327 327
                 $expiry = strtotime($durationStr, $timestamp);
328
-                $duration = ($expiry - $timestamp) / (60 * 60 * 24);
328
+                $duration = ($expiry-$timestamp) / (60 * 60 * 24);
329 329
 
330 330
                 if (!$duration || $duration > $this->longestBlockDays) {
331 331
                     $this->longestBlockDays = $duration;
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
410 410
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
411 411
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
412
-        return $import + $interwiki + $upload;
412
+        return $import+$interwiki+$upload;
413 413
     }
414 414
 
415 415
     /**
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
     public function approvals()
543 543
     {
544 544
         $logCounts = $this->getLogCounts();
545
-        $total = $logCounts['review-approve'] +
546
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
547
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
545
+        $total = $logCounts['review-approve']+
546
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
547
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
548 548
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
549 549
         return $total;
550 550
     }
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
         $logCounts = $this->getLogCounts();
569 569
         $create2 = $logCounts['newusers-create2'] ?: 0;
570 570
         $byemail = $logCounts['newusers-byemail'] ?: 0;
571
-        return $create2 + $byemail;
571
+        return $create2+$byemail;
572 572
     }
573 573
 
574 574
     /**
@@ -641,14 +641,14 @@  discard block
 block discarded – undo
641 641
             if (!isset($out['totals'][$ns])) {
642 642
                 $out['totals'][$ns] = [];
643 643
             }
644
-            $out['totals'][$ns][$total['year'] . $total['month']] = $total['count'];
644
+            $out['totals'][$ns][$total['year'].$total['month']] = $total['count'];
645 645
         }
646 646
         // Fill in the blanks (where no edits were made in a given month for a namespace).
647 647
         for ($y = $out['min_year']; $y <= $out['max_year']; $y++) {
648 648
             for ($m = 1; $m <= 12; $m++) {
649 649
                 foreach ($out['totals'] as $nsId => &$total) {
650
-                    if (!isset($total[$y . $m])) {
651
-                        $total[$y . $m] = 0;
650
+                    if (!isset($total[$y.$m])) {
651
+                        $total[$y.$m] = 0;
652 652
                     }
653 653
                 }
654 654
             }
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
                 ->globalEditCounts($this->user, $this->project);
715 715
             if ($sorted) {
716 716
                 // Sort.
717
-                uasort($this->globalEditCounts, function ($a, $b) {
718
-                    return $b['total'] - $a['total'];
717
+                uasort($this->globalEditCounts, function($a, $b) {
718
+                    return $b['total']-$a['total'];
719 719
                 });
720 720
             }
721 721
         }
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
754 754
             }
755 755
             $page = $project->getRepository()
756
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
756
+                ->getPage($project, $nsName.':'.$revision['page_title']);
757 757
             $edit = new Edit($page, $revision);
758 758
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
759 759
         }
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
      */
771 771
     protected function getEditSizeData()
772 772
     {
773
-        if (! is_array($this->editSizeData)) {
773
+        if (!is_array($this->editSizeData)) {
774 774
             $this->editSizeData = $this->getRepository()
775 775
                 ->getEditSizeData($this->project, $this->user);
776 776
         }
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
     public function countSmallEdits()
795 795
     {
796 796
         $editSizeData = $this->getEditSizeData();
797
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
797
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
798 798
     }
799 799
 
800 800
     /**
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
     public function countLargeEdits()
805 805
     {
806 806
         $editSizeData = $this->getEditSizeData();
807
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
807
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
808 808
     }
809 809
 
810 810
     /**
Please login to merge, or discard this patch.