@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Model; |
| 6 | 6 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | // Filter out unblocks unless requested. |
| 162 | 162 | if ($blocksOnly) { |
| 163 | - $blocks = array_filter($blocks, function ($block) { |
|
| 163 | + $blocks = array_filter($blocks, function($block) { |
|
| 164 | 164 | return 'block' === $block['log_action']; |
| 165 | 165 | }); |
| 166 | 166 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function countAllRevisions(): int |
| 196 | 196 | { |
| 197 | - return $this->countLiveRevisions() + $this->countDeletedRevisions(); |
|
| 197 | + return $this->countLiveRevisions()+$this->countDeletedRevisions(); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function countAllPagesEdited(): int |
| 235 | 235 | { |
| 236 | - return $this->countLivePagesEdited() + $this->countDeletedPagesEdited(); |
|
| 236 | + return $this->countLivePagesEdited()+$this->countDeletedPagesEdited(); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function countPagesCreated(): int |
| 245 | 245 | { |
| 246 | - return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted(); |
|
| 246 | + return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted(); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | } elseif ('unblock' === $block['log_action']) { |
| 373 | 373 | // The last block was lifted. So the duration will be the time from when the |
| 374 | 374 | // last block was set to the time of the unblock. |
| 375 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 375 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 376 | 376 | if ($timeSinceLastBlock > $this->longestBlockSeconds) { |
| 377 | 377 | $this->longestBlockSeconds = $timeSinceLastBlock; |
| 378 | 378 | |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | // The last block was modified. So we will adjust $lastBlock to include |
| 384 | 384 | // the difference of the duration of the new reblock, and time since the last block. |
| 385 | 385 | // $lastBlock is left unchanged if its duration was indefinite. |
| 386 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 387 | - $lastBlock[1] = $timeSinceLastBlock + $duration; |
|
| 386 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 387 | + $lastBlock[1] = $timeSinceLastBlock+$duration; |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // Test if the last block is still active, and if so use the expiry as the duration. |
| 397 | - $lastBlockExpiry = $lastBlock[0] + $lastBlock[1]; |
|
| 397 | + $lastBlockExpiry = $lastBlock[0]+$lastBlock[1]; |
|
| 398 | 398 | if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) { |
| 399 | 399 | $this->longestBlockSeconds = $lastBlock[1]; |
| 400 | 400 | // Otherwise, test if the duration of the last block is now the longest overall. |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | // If invalid, $duration is left as null. |
| 439 | 439 | if (strtotime($durationStr)) { |
| 440 | 440 | $expiry = strtotime($durationStr, $timestamp); |
| 441 | - $duration = $expiry - $timestamp; |
|
| 441 | + $duration = $expiry-$timestamp; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | return [$timestamp, $duration]; |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | $import = $logCounts['import-import'] ?? 0; |
| 526 | 526 | $interwiki = $logCounts['import-interwiki'] ?? 0; |
| 527 | 527 | $upload = $logCounts['import-upload'] ?? 0; |
| 528 | - return $import + $interwiki + $upload; |
|
| 528 | + return $import+$interwiki+$upload; |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | /** |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $logCounts = $this->getLogCounts(); |
| 548 | 548 | $new = $logCounts['contentmodel-new'] ?? 0; |
| 549 | 549 | $modified = $logCounts['contentmodel-change'] ?? 0; |
| 550 | - return $new + $modified; |
|
| 550 | + return $new+$modified; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
@@ -676,9 +676,9 @@ discard block |
||
| 676 | 676 | public function approvals(): int |
| 677 | 677 | { |
| 678 | 678 | $logCounts = $this->getLogCounts(); |
| 679 | - return (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0) + |
|
| 680 | - (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0) + |
|
| 681 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
| 679 | + return (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0)+ |
|
| 680 | + (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0)+ |
|
| 681 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
| 682 | 682 | (!empty($logCounts['review-approve2-i']) ? $logCounts['review-approve2-i'] : 0); |
| 683 | 683 | } |
| 684 | 684 | |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | $logCounts = $this->getLogCounts(); |
| 702 | 702 | $create2 = $logCounts['newusers-create2'] ?: 0; |
| 703 | 703 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
| 704 | - return $create2 + $byemail; |
|
| 704 | + return $create2+$byemail; |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /** |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | |
| 804 | 804 | $totals = $this->repository->getMonthCounts($this->project, $this->user); |
| 805 | 805 | $out = [ |
| 806 | - 'yearLabels' => [], // labels for years |
|
| 806 | + 'yearLabels' => [], // labels for years |
|
| 807 | 807 | 'monthLabels' => [], // labels for months |
| 808 | 808 | 'totals' => [], // actual totals, grouped by namespace, year and then month |
| 809 | 809 | ]; |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | $out['totals'][$ns][$total['year']] = []; |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | - $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count']; |
|
| 900 | + $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count']; |
|
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | return [$out, $firstEdit]; |
@@ -914,9 +914,9 @@ discard block |
||
| 914 | 914 | private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange): array |
| 915 | 915 | { |
| 916 | 916 | foreach ($dateRange as $monthObj) { |
| 917 | - $year = (int) $monthObj->format('Y'); |
|
| 917 | + $year = (int)$monthObj->format('Y'); |
|
| 918 | 918 | $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy'); |
| 919 | - $month = (int) $monthObj->format('n'); |
|
| 919 | + $month = (int)$monthObj->format('n'); |
|
| 920 | 920 | $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM'); |
| 921 | 921 | |
| 922 | 922 | // Fill in labels |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | public function countSmallEdits(): int |
| 1061 | 1061 | { |
| 1062 | 1062 | $editSizeData = $this->getEditSizeData(); |
| 1063 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
| 1063 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | /** |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | public function countLargeEdits(): int |
| 1071 | 1071 | { |
| 1072 | 1072 | $editSizeData = $this->getEditSizeData(); |
| 1073 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
| 1073 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | /** |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Repository; |
| 6 | 6 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | 'format' => 'json', |
| 197 | 197 | ], $params), |
| 198 | 198 | ])->getBody()->getContents(), true); |
| 199 | - } catch (ServerException|ConnectException $e) { |
|
| 199 | + } catch (ServerException | ConnectException $e) { |
|
| 200 | 200 | throw new BadGatewayException('api-error-wikimedia', ['Wikimedia'], $e); |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | // $tableExtension in order to generate the new table name |
| 219 | 219 | if ($this->isWMF && null !== $tableExtension) { |
| 220 | 220 | $mapped = true; |
| 221 | - $tableName .=('' === $tableExtension ? '' : '_'.$tableExtension); |
|
| 221 | + $tableName .= ('' === $tableExtension ? '' : '_'.$tableExtension); |
|
| 222 | 222 | } elseif ($this->parameterBag->has("app.table.$tableName")) { |
| 223 | 223 | // Use the table specified in the table mapping configuration, if present. |
| 224 | 224 | $mapped = true; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | // This is a safeguard in case table mapping isn't properly set up. |
| 231 | 231 | $isLoggingOrRevision = in_array($tableName, ['revision', 'logging', 'archive']); |
| 232 | 232 | if (!$mapped && $isLoggingOrRevision && $this->isWMF) { |
| 233 | - $tableName .="_userindex"; |
|
| 233 | + $tableName .= "_userindex"; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Figure out database name. |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $offset = date('YmdHis', $offset); |
| 350 | 350 | $datesConditions .= " AND $tableAlias{$field} <= '$offset'"; |
| 351 | 351 | } elseif (is_int($end)) { |
| 352 | - $end = date('Ymd', $end) . '235959'; |
|
| 352 | + $end = date('Ymd', $end).'235959'; |
|
| 353 | 353 | $datesConditions .= " AND $tableAlias{$field} <= '$end'"; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\EventSubscriber; |
| 6 | 6 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $cacheItem = $this->cache->getItem($cacheKey); |
| 171 | 171 | |
| 172 | 172 | // If increment value already in cache, or start with 1. |
| 173 | - $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1; |
|
| 173 | + $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1; |
|
| 174 | 174 | |
| 175 | 175 | // Check if limit has been exceeded, and if so, throw an error. |
| 176 | 176 | if ($count > $this->rateLimit) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $cacheItem = $this->cache->getItem($cacheKey); |
| 211 | 211 | |
| 212 | 212 | // If increment value already in cache, or start with 1. |
| 213 | - $count = $cacheItem->isHit() ? (int)$cacheItem->get() + 1 : 1; |
|
| 213 | + $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1; |
|
| 214 | 214 | |
| 215 | 215 | // Check if limit has been exceeded, and if so, add a log entry. |
| 216 | 216 | if ($count > 3) { |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Exception; |
| 6 | 6 | |