@@ -435,7 +435,6 @@ |
||
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Get data for a bar chart of monthly edit totals per namespace. |
438 | - * @param string $username The username. |
|
439 | 438 | * @return string[] |
440 | 439 | */ |
441 | 440 | public function getMonthCounts(Project $project, User $user) |
@@ -6,9 +6,6 @@ |
||
6 | 6 | use DateInterval; |
7 | 7 | use DateTime; |
8 | 8 | use Mediawiki\Api\SimpleRequest; |
9 | -use Mediawiki\Api\UsageException; |
|
10 | -use MediaWiki\OAuthClient\Exception; |
|
11 | -use Symfony\Component\VarDumper\VarDumper; |
|
12 | 9 | |
13 | 10 | class EditCounterRepository extends Repository |
14 | 11 | { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getUrl($withTrailingSlash = true) |
81 | 81 | { |
82 | - return rtrim($this->getMetadata()['url'], '/') . ($withTrailingSlash ? '/' : ''); |
|
82 | + return rtrim($this->getMetadata()['url'], '/').($withTrailingSlash ? '/' : ''); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function userOptInPage(User $user) |
154 | 154 | { |
155 | - $localPageName = $user->getUsername() . '/EditCounterOptIn.js'; |
|
155 | + $localPageName = $user->getUsername().'/EditCounterOptIn.js'; |
|
156 | 156 | return $localPageName; |
157 | 157 | } |
158 | 158 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | // 3. Lastly, see if they've opted in globally on the default project or Meta. |
184 | - $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js'; |
|
184 | + $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js'; |
|
185 | 185 | $globalProject = $this->getRepository()->getGlobalProject(); |
186 | 186 | if ($globalProject instanceof Project) { |
187 | 187 | $globalExists = $globalProject->getRepository() |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | protected function getRevisionCounts() |
53 | 53 | { |
54 | - if (! is_array($this->revisionCounts)) { |
|
54 | + if (!is_array($this->revisionCounts)) { |
|
55 | 55 | $this->revisionCounts = $this->getRepository() |
56 | 56 | ->getRevisionCounts($this->project, $this->user); |
57 | 57 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function getRevisionDates() |
66 | 66 | { |
67 | - if (! is_array($this->revisionDates)) { |
|
67 | + if (!is_array($this->revisionDates)) { |
|
68 | 68 | $this->revisionDates = $this->getRepository() |
69 | 69 | ->getRevisionDates($this->project, $this->user); |
70 | 70 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function getPageCounts() |
79 | 79 | { |
80 | - if (! is_array($this->pageCounts)) { |
|
80 | + if (!is_array($this->pageCounts)) { |
|
81 | 81 | $this->pageCounts = $this->getRepository() |
82 | 82 | ->getPageCounts($this->project, $this->user); |
83 | 83 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function getLogCounts() |
92 | 92 | { |
93 | - if (! is_array($this->logCounts)) { |
|
93 | + if (!is_array($this->logCounts)) { |
|
94 | 94 | $this->logCounts = $this->getRepository() |
95 | 95 | ->getLogCounts($this->project, $this->user); |
96 | 96 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function countAllRevisions() |
121 | 121 | { |
122 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
122 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function countRevisionsWithoutComments() |
140 | 140 | { |
141 | - return $this->countAllRevisions() - $this->countRevisionsWithComments(); |
|
141 | + return $this->countAllRevisions()-$this->countRevisionsWithComments(); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -205,7 +205,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -373,9 +373,9 @@ discard block |
||
373 | 373 | public function approvals() |
374 | 374 | { |
375 | 375 | $logCounts = $this->getLogCounts(); |
376 | - $total = $logCounts['review-approve'] + |
|
377 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
378 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
376 | + $total = $logCounts['review-approve']+ |
|
377 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
378 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
379 | 379 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
380 | 380 | return $total; |
381 | 381 | } |
@@ -452,14 +452,14 @@ discard block |
||
452 | 452 | if (!isset($out['totals'][$ns])) { |
453 | 453 | $out['totals'][$ns] = []; |
454 | 454 | } |
455 | - $out['totals'][$ns][$total['year'] . $total['month']] = $total['count']; |
|
455 | + $out['totals'][$ns][$total['year'].$total['month']] = $total['count']; |
|
456 | 456 | } |
457 | 457 | // Fill in the blanks (where no edits were made in a given month for a namespace). |
458 | 458 | for ($y = $out['min_year']; $y <= $out['max_year']; $y++) { |
459 | 459 | for ($m = 1; $m <= 12; $m++) { |
460 | 460 | foreach ($out['totals'] as $nsId => &$total) { |
461 | - if (!isset($total[$y . $m])) { |
|
462 | - $total[$y . $m] = 0; |
|
461 | + if (!isset($total[$y.$m])) { |
|
462 | + $total[$y.$m] = 0; |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | // Get counts. |
478 | 478 | $editCounts = $this->globalEditCounts(); |
479 | 479 | // Sort. |
480 | - uasort($editCounts, function ($a, $b) { |
|
481 | - return $b['total'] - $a['total']; |
|
480 | + uasort($editCounts, function($a, $b) { |
|
481 | + return $b['total']-$a['total']; |
|
482 | 482 | }); |
483 | 483 | // Truncate, and return. |
484 | 484 | return array_slice($editCounts, 0, $numProjects); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | krsort($globalRevisions); |
547 | 547 | $globalRevisions = array_slice($globalRevisions, 0, $max); |
548 | 548 | } |
549 | - dump($globalRevisions);exit(); |
|
549 | + dump($globalRevisions); exit(); |
|
550 | 550 | return $globalRevisions; |
551 | 551 | } |
552 | 552 | } |