@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | $promises[] = $promise; |
| 132 | 132 | |
| 133 | 133 | // Handle response of $promise asynchronously. |
| 134 | - $promise->then(function ($response) use ($key, $endpoint) { |
|
| 135 | - $result = (array) json_decode($response->getBody()->getContents()); |
|
| 134 | + $promise->then(function($response) use ($key, $endpoint) { |
|
| 135 | + $result = (array)json_decode($response->getBody()->getContents()); |
|
| 136 | 136 | |
| 137 | 137 | $this->getRepository() |
| 138 | 138 | ->getLog() |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | // We'll log this to see how often it happens. |
| 150 | 150 | $this->getRepository() |
| 151 | 151 | ->getLog() |
| 152 | - ->error("Failed to fetch data for $endpoint via async, " . |
|
| 152 | + ->error("Failed to fetch data for $endpoint via async, ". |
|
| 153 | 153 | "re-attempting synchoronously."); |
| 154 | 154 | } |
| 155 | 155 | }); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | // Filter out unblocks unless requested. |
| 207 | 207 | if ($blocksOnly) { |
| 208 | - $blocks = array_filter($blocks, function ($block) { |
|
| 208 | + $blocks = array_filter($blocks, function($block) { |
|
| 209 | 209 | return $block['log_action'] === 'block'; |
| 210 | 210 | }); |
| 211 | 211 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | public function countAllRevisions() |
| 379 | 379 | { |
| 380 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
| 380 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | public function countRevisionsWithoutComments() |
| 398 | 398 | { |
| 399 | - return $this->countLiveRevisions() - $this->countRevisionsWithComments(); |
|
| 399 | + return $this->countLiveRevisions()-$this->countRevisionsWithComments(); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | public function countAllPagesEdited() |
| 437 | 437 | { |
| 438 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
| 438 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | public function countPagesCreated() |
| 447 | 447 | { |
| 448 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
| 448 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | } elseif ($block['log_action'] === 'unblock') { |
| 586 | 586 | // The last block was lifted. So the duration will be the time from when the |
| 587 | 587 | // last block was set to the time of the unblock. |
| 588 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 588 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 589 | 589 | if ($timeSinceLastBlock > $this->longestBlockSeconds) { |
| 590 | 590 | $this->longestBlockSeconds = $timeSinceLastBlock; |
| 591 | 591 | |
@@ -596,8 +596,8 @@ discard block |
||
| 596 | 596 | // The last block was modified. So we will adjust $lastBlock to include |
| 597 | 597 | // the difference of the duration of the new reblock, and time since the last block. |
| 598 | 598 | // $lastBlock is left unchanged if its duration was indefinite. |
| 599 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 600 | - $lastBlock[1] = $timeSinceLastBlock + $duration; |
|
| 599 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 600 | + $lastBlock[1] = $timeSinceLastBlock+$duration; |
|
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | // Test if the last block is still active, and if so use the expiry as the duration. |
| 610 | - $lastBlockExpiry = $lastBlock[0] + $lastBlock[1]; |
|
| 610 | + $lastBlockExpiry = $lastBlock[0]+$lastBlock[1]; |
|
| 611 | 611 | if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) { |
| 612 | 612 | $this->longestBlockSeconds = $lastBlock[1]; |
| 613 | 613 | // Otherwise, test if the duration of the last block is now the longest overall. |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | // If invalid, $duration is left as null. |
| 649 | 649 | if (strtotime($durationStr)) { |
| 650 | 650 | $expiry = strtotime($durationStr, $timestamp); |
| 651 | - $duration = $expiry - $timestamp; |
|
| 651 | + $duration = $expiry-$timestamp; |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | return [$timestamp, $duration]; |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0; |
| 726 | 726 | $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0; |
| 727 | 727 | $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0; |
| 728 | - return $import + $interwiki + $upload; |
|
| 728 | + return $import+$interwiki+$upload; |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | /** |
@@ -852,9 +852,9 @@ discard block |
||
| 852 | 852 | public function approvals() |
| 853 | 853 | { |
| 854 | 854 | $logCounts = $this->getLogCounts(); |
| 855 | - $total = $logCounts['review-approve'] + |
|
| 856 | - (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) + |
|
| 857 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
| 855 | + $total = $logCounts['review-approve']+ |
|
| 856 | + (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+ |
|
| 857 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
| 858 | 858 | (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0); |
| 859 | 859 | return $total; |
| 860 | 860 | } |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | $logCounts = $this->getLogCounts(); |
| 879 | 879 | $create2 = $logCounts['newusers-create2'] ?: 0; |
| 880 | 880 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
| 881 | - return $create2 + $byemail; |
|
| 881 | + return $create2+$byemail; |
|
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | /** |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | |
| 962 | 962 | $totals = $this->getRepository()->getMonthCounts($this->project, $this->user); |
| 963 | 963 | $out = [ |
| 964 | - 'yearLabels' => [], // labels for years |
|
| 964 | + 'yearLabels' => [], // labels for years |
|
| 965 | 965 | 'monthLabels' => [], // labels for months |
| 966 | 966 | 'totals' => [], // actual totals, grouped by namespace, year and then month |
| 967 | 967 | ]; |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | $out['totals'][$ns][$total['year']] = []; |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | - $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count']; |
|
| 1031 | + $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count']; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | return [$out, $firstEdit]; |
@@ -1045,9 +1045,9 @@ discard block |
||
| 1045 | 1045 | private function fillInMonthTotalsAndLabels($out, DatePeriod $dateRange) |
| 1046 | 1046 | { |
| 1047 | 1047 | foreach ($dateRange as $monthObj) { |
| 1048 | - $year = (int) $monthObj->format('Y'); |
|
| 1048 | + $year = (int)$monthObj->format('Y'); |
|
| 1049 | 1049 | // $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy'); |
| 1050 | - $month = (int) $monthObj->format('n'); |
|
| 1050 | + $month = (int)$monthObj->format('n'); |
|
| 1051 | 1051 | |
| 1052 | 1052 | // Fill in labels |
| 1053 | 1053 | $out['monthLabels'][] = $monthObj->format('Y-m'); |
@@ -1195,8 +1195,8 @@ discard block |
||
| 1195 | 1195 | |
| 1196 | 1196 | if ($sorted) { |
| 1197 | 1197 | // Sort. |
| 1198 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
| 1199 | - return $b['total'] - $a['total']; |
|
| 1198 | + uasort($this->globalEditCounts, function($a, $b) { |
|
| 1199 | + return $b['total']-$a['total']; |
|
| 1200 | 1200 | }); |
| 1201 | 1201 | } |
| 1202 | 1202 | |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | $nsName = $project->getNamespaces()[$revision['page_namespace']]; |
| 1241 | 1241 | } |
| 1242 | 1242 | $page = $project->getRepository() |
| 1243 | - ->getPage($project, $nsName . ':' . $revision['page_title']); |
|
| 1243 | + ->getPage($project, $nsName.':'.$revision['page_title']); |
|
| 1244 | 1244 | $edit = new Edit($page, $revision); |
| 1245 | 1245 | $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit; |
| 1246 | 1246 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | public function countSmallEdits() |
| 1283 | 1283 | { |
| 1284 | 1284 | $editSizeData = $this->getEditSizeData(); |
| 1285 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
| 1285 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | /** |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | public function countLargeEdits() |
| 1293 | 1293 | { |
| 1294 | 1294 | $editSizeData = $this->getEditSizeData(); |
| 1295 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
| 1295 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | 1298 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function requestTime() |
| 112 | 112 | { |
| 113 | 113 | if (!isset($this->requestTime)) { |
| 114 | - $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 114 | + $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | return $this->requestTime; |
@@ -674,15 +674,15 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | if ($seconds >= 86400) { |
| 676 | 676 | // Over a day |
| 677 | - $val = (int) floor($seconds / 86400); |
|
| 677 | + $val = (int)floor($seconds / 86400); |
|
| 678 | 678 | $key = 'days'; |
| 679 | 679 | } elseif ($seconds >= 3600) { |
| 680 | 680 | // Over an hour, less than a day |
| 681 | - $val = (int) floor($seconds / 3600); |
|
| 681 | + $val = (int)floor($seconds / 3600); |
|
| 682 | 682 | $key = 'hours'; |
| 683 | 683 | } elseif ($seconds >= 60) { |
| 684 | 684 | // Over a minute, less than an hour |
| 685 | - $val = (int) floor($seconds / 60); |
|
| 685 | + $val = (int)floor($seconds / 60); |
|
| 686 | 686 | $key = 'minutes'; |
| 687 | 687 | } |
| 688 | 688 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Find the path, and complain if English doesn't exist. |
| 75 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
| 75 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
| 76 | 76 | if (!file_exists("$path/en.json")) { |
| 77 | 77 | throw new Exception("Language directory doesn't exist: $path"); |
| 78 | 78 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $messageFiles = glob($this->container->getParameter('kernel.root_dir').'/../i18n/*.json'); |
| 128 | 128 | |
| 129 | 129 | $languages = array_values(array_unique(array_map( |
| 130 | - function ($filename) { |
|
| 130 | + function($filename) { |
|
| 131 | 131 | return basename($filename, '.json'); |
| 132 | 132 | }, |
| 133 | 133 | $messageFiles |