Completed
Pull Request — master (#76)
by MusikAnimal
03:48
created
src/Xtools/EditCounter.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     protected function getPairData()
84 84
     {
85
-        if (! is_array($this->pairData)) {
85
+        if (!is_array($this->pairData)) {
86 86
             $this->pairData = $this->getRepository()
87 87
                 ->getPairData($this->project, $this->user);
88 88
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     protected function getLogCounts()
97 97
     {
98
-        if (! is_array($this->logCounts)) {
98
+        if (!is_array($this->logCounts)) {
99 99
             $this->logCounts = $this->getRepository()
100 100
                 ->getLogCounts($this->project, $this->user);
101 101
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function countAllRevisions()
146 146
     {
147
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
147
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
148 148
     }
149 149
 
150 150
     /**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      */
164 164
     public function countRevisionsWithoutComments()
165 165
     {
166
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
166
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
167 167
     }
168 168
 
169 169
     /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function countAllPagesEdited()
204 204
     {
205
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
205
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
206 206
     }
207 207
 
208 208
     /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function countPagesCreated()
214 214
     {
215
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
215
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
216 216
     }
217 217
 
218 218
     /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             // Try block just in case there are older, unpredictable formats
341 341
             try {
342 342
                 $expiry = strtotime($durationStr, $timestamp);
343
-                $duration = ($expiry - $timestamp) / (60 * 60 * 24);
343
+                $duration = ($expiry-$timestamp) / (60 * 60 * 24);
344 344
 
345 345
                 if (!$duration || $duration > $this->longestBlockDays) {
346 346
                     $this->longestBlockDays = $duration;
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
425 425
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
426 426
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
427
-        return $import + $interwiki + $upload;
427
+        return $import+$interwiki+$upload;
428 428
     }
429 429
 
430 430
     /**
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
     public function approvals()
549 549
     {
550 550
         $logCounts = $this->getLogCounts();
551
-        $total = $logCounts['review-approve'] +
552
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
553
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
551
+        $total = $logCounts['review-approve']+
552
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
553
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
554 554
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
555 555
         return $total;
556 556
     }
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
         $logCounts = $this->getLogCounts();
575 575
         $create2 = $logCounts['newusers-create2'] ?: 0;
576 576
         $byemail = $logCounts['newusers-byemail'] ?: 0;
577
-        return $create2 + $byemail;
577
+        return $create2+$byemail;
578 578
     }
579 579
 
580 580
     /**
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 
623 623
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
624 624
         $out = [
625
-            'yearLabels' => [],  // labels for years
625
+            'yearLabels' => [], // labels for years
626 626
             'monthLabels' => [], // labels for months
627 627
             'totals' => [], // actual totals, grouped by namespace, year and then month
628 628
         ];
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
                 $out['totals'][$ns][$total['year']] = [];
651 651
             }
652 652
 
653
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
653
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
654 654
         }
655 655
 
656 656
         $dateRange = new DatePeriod(
@@ -660,8 +660,8 @@  discard block
 block discarded – undo
660 660
         );
661 661
 
662 662
         foreach ($dateRange as $monthObj) {
663
-            $year = (int) $monthObj->format('Y');
664
-            $month = (int) $monthObj->format('n');
663
+            $year = (int)$monthObj->format('Y');
664
+            $month = (int)$monthObj->format('n');
665 665
 
666 666
             // Fill in labels
667 667
             $out['monthLabels'][] = $monthObj->format('Y-m');
@@ -770,8 +770,8 @@  discard block
 block discarded – undo
770 770
                 ->globalEditCounts($this->user, $this->project);
771 771
             if ($sorted) {
772 772
                 // Sort.
773
-                uasort($this->globalEditCounts, function ($a, $b) {
774
-                    return $b['total'] - $a['total'];
773
+                uasort($this->globalEditCounts, function($a, $b) {
774
+                    return $b['total']-$a['total'];
775 775
                 });
776 776
             }
777 777
         }
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
808 808
             }
809 809
             $page = $project->getRepository()
810
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
810
+                ->getPage($project, $nsName.':'.$revision['page_title']);
811 811
             $edit = new Edit($page, $revision);
812 812
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
813 813
         }
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
      */
825 825
     protected function getEditSizeData()
826 826
     {
827
-        if (! is_array($this->editSizeData)) {
827
+        if (!is_array($this->editSizeData)) {
828 828
             $this->editSizeData = $this->getRepository()
829 829
                 ->getEditSizeData($this->project, $this->user);
830 830
         }
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
     public function countSmallEdits()
849 849
     {
850 850
         $editSizeData = $this->getEditSizeData();
851
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
851
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
852 852
     }
853 853
 
854 854
     /**
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
     public function countLargeEdits()
859 859
     {
860 860
         $editSizeData = $this->getEditSizeData();
861
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
861
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
862 862
     }
863 863
 
864 864
     /**
Please login to merge, or discard this patch.