@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the EditCounter class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | // Filter out unblocks unless requested. |
| 139 | 139 | if ($blocksOnly) { |
| 140 | - $blocks = array_filter($blocks, function ($block) { |
|
| 140 | + $blocks = array_filter($blocks, function($block) { |
|
| 141 | 141 | return 'block' === $block['log_action']; |
| 142 | 142 | }); |
| 143 | 143 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function countAllRevisions(): int |
| 173 | 173 | { |
| 174 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
| 174 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function countAllPagesEdited(): int |
| 212 | 212 | { |
| 213 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
| 213 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function countPagesCreated(): int |
| 222 | 222 | { |
| 223 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
| 223 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | } elseif ('unblock' === $block['log_action']) { |
| 361 | 361 | // The last block was lifted. So the duration will be the time from when the |
| 362 | 362 | // last block was set to the time of the unblock. |
| 363 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 363 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 364 | 364 | if ($timeSinceLastBlock > $this->longestBlockSeconds) { |
| 365 | 365 | $this->longestBlockSeconds = $timeSinceLastBlock; |
| 366 | 366 | |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | // The last block was modified. So we will adjust $lastBlock to include |
| 372 | 372 | // the difference of the duration of the new reblock, and time since the last block. |
| 373 | 373 | // $lastBlock is left unchanged if its duration was indefinite. |
| 374 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 375 | - $lastBlock[1] = $timeSinceLastBlock + $duration; |
|
| 374 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 375 | + $lastBlock[1] = $timeSinceLastBlock+$duration; |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | // Test if the last block is still active, and if so use the expiry as the duration. |
| 385 | - $lastBlockExpiry = $lastBlock[0] + $lastBlock[1]; |
|
| 385 | + $lastBlockExpiry = $lastBlock[0]+$lastBlock[1]; |
|
| 386 | 386 | if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) { |
| 387 | 387 | $this->longestBlockSeconds = $lastBlock[1]; |
| 388 | 388 | // Otherwise, test if the duration of the last block is now the longest overall. |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | // If invalid, $duration is left as null. |
| 427 | 427 | if (strtotime($durationStr)) { |
| 428 | 428 | $expiry = strtotime($durationStr, $timestamp); |
| 429 | - $duration = $expiry - $timestamp; |
|
| 429 | + $duration = $expiry-$timestamp; |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | return [$timestamp, $duration]; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0; |
| 514 | 514 | $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0; |
| 515 | 515 | $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0; |
| 516 | - return $import + $interwiki + $upload; |
|
| 516 | + return $import+$interwiki+$upload; |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | public function countAbuseFilterchanges(): int |
@@ -633,9 +633,9 @@ discard block |
||
| 633 | 633 | public function approvals(): int |
| 634 | 634 | { |
| 635 | 635 | $logCounts = $this->getLogCounts(); |
| 636 | - $total = (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0) + |
|
| 637 | - (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0) + |
|
| 638 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
| 636 | + $total = (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0)+ |
|
| 637 | + (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0)+ |
|
| 638 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
| 639 | 639 | (!empty($logCounts['review-approve2-i']) ? $logCounts['review2-approve-i'] : 0); |
| 640 | 640 | return $total; |
| 641 | 641 | } |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | $logCounts = $this->getLogCounts(); |
| 660 | 660 | $create2 = $logCounts['newusers-create2'] ?: 0; |
| 661 | 661 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
| 662 | - return $create2 + $byemail; |
|
| 662 | + return $create2+$byemail; |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | /** |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | |
| 762 | 762 | $totals = $this->getRepository()->getMonthCounts($this->project, $this->user); |
| 763 | 763 | $out = [ |
| 764 | - 'yearLabels' => [], // labels for years |
|
| 764 | + 'yearLabels' => [], // labels for years |
|
| 765 | 765 | 'monthLabels' => [], // labels for months |
| 766 | 766 | 'totals' => [], // actual totals, grouped by namespace, year and then month |
| 767 | 767 | ]; |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | $out['totals'][$ns][$total['year']] = []; |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | - $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count']; |
|
| 858 | + $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count']; |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | return [$out, $firstEdit]; |
@@ -872,9 +872,9 @@ discard block |
||
| 872 | 872 | private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange): array |
| 873 | 873 | { |
| 874 | 874 | foreach ($dateRange as $monthObj) { |
| 875 | - $year = (int) $monthObj->format('Y'); |
|
| 875 | + $year = (int)$monthObj->format('Y'); |
|
| 876 | 876 | $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy'); |
| 877 | - $month = (int) $monthObj->format('n'); |
|
| 877 | + $month = (int)$monthObj->format('n'); |
|
| 878 | 878 | $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM'); |
| 879 | 879 | |
| 880 | 880 | // Fill in labels |
@@ -1044,8 +1044,8 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | if ($sorted) { |
| 1046 | 1046 | // Sort. |
| 1047 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
| 1048 | - return $b['total'] - $a['total']; |
|
| 1047 | + uasort($this->globalEditCounts, function($a, $b) { |
|
| 1048 | + return $b['total']-$a['total']; |
|
| 1049 | 1049 | }); |
| 1050 | 1050 | } |
| 1051 | 1051 | |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | // Registered accounts; for these we go by globalEditCounts() which uses CentralAuth. |
| 1066 | 1066 | $projects = []; |
| 1067 | - $globalCounts = array_column(array_filter($this->globalEditCounts(), function ($row) { |
|
| 1067 | + $globalCounts = array_column(array_filter($this->globalEditCounts(), function($row) { |
|
| 1068 | 1068 | return $row['total'] > 0; |
| 1069 | 1069 | }), 'project'); |
| 1070 | 1070 | foreach ($globalCounts as $globalCount) { |
@@ -1152,7 +1152,7 @@ discard block |
||
| 1152 | 1152 | public function countSmallEdits(): int |
| 1153 | 1153 | { |
| 1154 | 1154 | $editSizeData = $this->getEditSizeData(); |
| 1155 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
| 1155 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | 1158 | /** |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | public function countLargeEdits(): int |
| 1163 | 1163 | { |
| 1164 | 1164 | $editSizeData = $this->getEditSizeData(); |
| 1165 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
| 1165 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | /** |