Completed
Push — master ( fd3d21...1cb40b )
by Sam
02:55
created
src/Xtools/EditCounter.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     protected function getPairData()
56 56
     {
57
-        if (! is_array($this->pairData)) {
57
+        if (!is_array($this->pairData)) {
58 58
             $this->pairData = $this->getRepository()
59 59
                 ->getPairData($this->project, $this->user);
60 60
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function getLogCounts()
69 69
     {
70
-        if (! is_array($this->logCounts)) {
70
+        if (!is_array($this->logCounts)) {
71 71
             $this->logCounts = $this->getRepository()
72 72
                 ->getLogCounts($this->project, $this->user);
73 73
         }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function countAllRevisions()
118 118
     {
119
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
119
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
120 120
     }
121 121
 
122 122
     /**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function countRevisionsWithoutComments()
137 137
     {
138
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
138
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
139 139
     }
140 140
 
141 141
     /**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function countAllPagesEdited()
207 207
     {
208
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
208
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
209 209
     }
210 210
 
211 211
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function countPagesCreated()
217 217
     {
218
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
218
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
219 219
     }
220 220
 
221 221
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $logCounts = $this->getLogCounts();
268 268
         $block = isset($logCounts['block-block']) ? (int)$logCounts['block-block'] : 0;
269 269
         $reBlock = isset($logCounts['block-reblock']) ? (int)$logCounts['block-reblock'] : 0;
270
-        return $block + $reBlock;
270
+        return $block+$reBlock;
271 271
     }
272 272
 
273 273
     /**
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
366 366
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
367 367
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
368
-        return $import + $interwiki + $upload;
368
+        return $import+$interwiki+$upload;
369 369
     }
370 370
 
371 371
     /**
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
     public function approvals()
499 499
     {
500 500
         $logCounts = $this->getLogCounts();
501
-        $total = $logCounts['review-approve'] +
502
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
503
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
501
+        $total = $logCounts['review-approve']+
502
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
503
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
504 504
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
505 505
         return $total;
506 506
     }
@@ -582,14 +582,14 @@  discard block
 block discarded – undo
582 582
             if (!isset($out['totals'][$ns])) {
583 583
                 $out['totals'][$ns] = [];
584 584
             }
585
-            $out['totals'][$ns][$total['year'] . $total['month']] = $total['count'];
585
+            $out['totals'][$ns][$total['year'].$total['month']] = $total['count'];
586 586
         }
587 587
         // Fill in the blanks (where no edits were made in a given month for a namespace).
588 588
         for ($y = $out['min_year']; $y <= $out['max_year']; $y++) {
589 589
             for ($m = 1; $m <= 12; $m++) {
590 590
                 foreach ($out['totals'] as $nsId => &$total) {
591
-                    if (!isset($total[$y . $m])) {
592
-                        $total[$y . $m] = 0;
591
+                    if (!isset($total[$y.$m])) {
592
+                        $total[$y.$m] = 0;
593 593
                     }
594 594
                 }
595 595
             }
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
                 ->globalEditCounts($this->user, $this->project);
652 652
             if ($sorted) {
653 653
                 // Sort.
654
-                uasort($this->globalEditCounts, function ($a, $b) {
655
-                    return $b['total'] - $a['total'];
654
+                uasort($this->globalEditCounts, function($a, $b) {
655
+                    return $b['total']-$a['total'];
656 656
                 });
657 657
             }
658 658
         }
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
691 691
             }
692 692
             $page = $project->getRepository()
693
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
693
+                ->getPage($project, $nsName.':'.$revision['page_title']);
694 694
             $edit = new Edit($page, $revision);
695 695
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
696 696
         }
Please login to merge, or discard this patch.
src/Xtools/EditCounterRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public function getPairData(Project $project, User $user)
28 28
     {
29 29
         // Set up cache.
30
-        $cacheKey = 'pairdata.' . $project->getDatabaseName() . '.' . $user->getUsername();
30
+        $cacheKey = 'pairdata.'.$project->getDatabaseName().'.'.$user->getUsername();
31 31
         if ($this->cache->hasItem($cacheKey)) {
32 32
             return $this->cache->getItem($cacheKey)->get();
33 33
         }
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
         $resultQuery->execute();
154 154
         $results = $resultQuery->fetchAll();
155 155
         $logCounts = array_combine(
156
-            array_map(function ($e) {
156
+            array_map(function($e) {
157 157
                 return $e['source'];
158 158
             }, $results),
159
-            array_map(function ($e) {
159
+            array_map(function($e) {
160 160
                 return $e['value'];
161 161
             }, $results)
162 162
         );
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
         $resultQuery->bindParam(":id", $userId);
379 379
         $resultQuery->execute();
380 380
         $results = $resultQuery->fetchAll();
381
-        $namespaceTotals = array_combine(array_map(function ($e) {
381
+        $namespaceTotals = array_combine(array_map(function($e) {
382 382
             return $e['page_namespace'];
383
-        }, $results), array_map(function ($e) {
383
+        }, $results), array_map(function($e) {
384 384
             return $e['total'];
385 385
         }, $results));
386 386
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             }
440 440
             $queries[] = $sql;
441 441
         }
442
-        $sql = "(\n" . join("\n) UNION (\n", $queries) . ")\n";
442
+        $sql = "(\n".join("\n) UNION (\n", $queries).")\n";
443 443
         $resultQuery = $this->getProjectsConnection()->prepare($sql);
444 444
         $resultQuery->bindParam(":username", $username);
445 445
         $resultQuery->execute();
Please login to merge, or discard this patch.