@@ -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 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function getUrl(bool $withTrailingSlash = true): string |
| 157 | 157 | { |
| 158 | - return rtrim($this->getBasicInfo()['url'], '/') . ($withTrailingSlash ? '/' : ''); |
|
| 158 | + return rtrim($this->getBasicInfo()['url'], '/').($withTrailingSlash ? '/' : ''); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | public function getScript(): string |
| 192 | 192 | { |
| 193 | 193 | $metadata = $this->getMetadata(); |
| 194 | - return $metadata['general']['script'] ?? $this->getScriptPath() . '/index.php'; |
|
| 194 | + return $metadata['general']['script'] ?? $this->getScriptPath().'/index.php'; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function getApiUrl(): string |
| 202 | 202 | { |
| 203 | - return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath(); |
|
| 203 | + return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath(); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function userOptInPage(User $user): string |
| 277 | 277 | { |
| 278 | - return 'User:' . $user->getUsername() . '/EditCounterOptIn.js'; |
|
| 278 | + return 'User:'.$user->getUsername().'/EditCounterOptIn.js'; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // 4. Lastly, see if they've opted in globally on the default project or Meta. |
| 312 | - $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js'; |
|
| 312 | + $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js'; |
|
| 313 | 313 | $globalProject = $this->getRepository()->getGlobalProject(); |
| 314 | 314 | $globalExists = $globalProject->getRepository() |
| 315 | 315 | ->pageHasContent($globalProject, $userNsId, $globalPageName); |
@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | User $user, |
| 99 | 99 | array $revs |
| 100 | 100 | ): array { |
| 101 | - return array_map(function ($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) { |
|
| 101 | + return array_map(function($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) { |
|
| 102 | 102 | /** Page object to be passed to the Edit constructor. */ |
| 103 | 103 | $page = Page::newFromRow($pageRepo, $project, $rev); |
| 104 | 104 | $rev['user'] = $user; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
| 321 | 321 | |
| 322 | 322 | if ($isSection && isset($page)) { |
| 323 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 323 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 324 | 324 | '$1', |
| 325 | 325 | $page->getTitle($useUnnormalizedPageTitle), |
| 326 | 326 | $project->getArticlePath() |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | // Must have underscores for the link to properly go to the section. |
| 331 | 331 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
| 332 | 332 | |
| 333 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
| 334 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
| 333 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
| 334 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
| 335 | 335 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
| 336 | 336 | } |
| 337 | 337 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | ); |
| 346 | 346 | |
| 347 | 347 | // Use normalized page title (underscored, capitalized). |
| 348 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 348 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 349 | 349 | '$1', |
| 350 | 350 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
| 351 | 351 | $project->getArticlePath() |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | public function getDiffUrl(): string |
| 384 | 384 | { |
| 385 | 385 | $project = $this->getProject(); |
| 386 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
| 387 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 386 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
| 387 | + return rtrim($project->getUrl(), '/').$path; |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | /** |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | public function getPermaUrl(): string |
| 395 | 395 | { |
| 396 | 396 | $project = $this->getProject(); |
| 397 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
| 398 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 397 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
| 398 | + return rtrim($project->getUrl(), '/').$path; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /** |
@@ -474,10 +474,10 @@ discard block |
||
| 474 | 474 | $ret['reverted'] = $this->reverted; |
| 475 | 475 | } |
| 476 | 476 | if ($includeUsername) { |
| 477 | - $ret = [ 'username' => $this->getUser()->getUsername() ] + $ret; |
|
| 477 | + $ret = ['username' => $this->getUser()->getUsername()]+$ret; |
|
| 478 | 478 | } |
| 479 | 479 | if ($includeProject) { |
| 480 | - $ret = [ 'project' => $this->getProject()->getDomain() ] + $ret; |
|
| 480 | + $ret = ['project' => $this->getProject()->getDomain()]+$ret; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | return $ret; |
@@ -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 | |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | $now = new DateTime(); |
| 104 | 104 | $date = new DateTime($value); |
| 105 | 105 | $diff = $date->diff($now); |
| 106 | - $formula = 365 * (int)$diff->format('%y') + 30 * |
|
| 107 | - (int)$diff->format('%m') + (int)$diff->format('%d'); |
|
| 106 | + $formula = 365 * (int)$diff->format('%y')+30 * |
|
| 107 | + (int)$diff->format('%m')+(int)$diff->format('%d'); |
|
| 108 | 108 | if ($formula < 365) { |
| 109 | 109 | $this->multipliers['account-age-mult'] = 0; |
| 110 | 110 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $multiplierKey = $row['source'] . '-mult'; |
|
| 115 | + $multiplierKey = $row['source'].'-mult'; |
|
| 116 | 116 | $multiplier = $this->multipliers[$multiplierKey] ?? 1; |
| 117 | 117 | $score = max(min($value * $multiplier, 100), -100); |
| 118 | 118 | $this->scores[$key]['mult'] = $multiplier; |
@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $stats = $this->groupStatsByUsername($stats); |
| 99 | 99 | |
| 100 | 100 | // Resort, as for some reason the SQL doesn't do this properly. |
| 101 | - uasort($stats, function ($a, $b) { |
|
| 101 | + uasort($stats, function($a, $b) { |
|
| 102 | 102 | if ($a['total'] === $b['total']) { |
| 103 | 103 | return 0; |
| 104 | 104 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $this->usersAndGroups = $this->project->getUsersInGroups($groupUserGroups['local'], $groupUserGroups['global']); |
| 127 | 127 | |
| 128 | 128 | // Populate $this->usersInGroup with users who are in the relevant user group for $this->group. |
| 129 | - $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function ($groups) { |
|
| 129 | + $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function($groups) { |
|
| 130 | 130 | return in_array($this->getRelevantUserGroup(), $groups); |
| 131 | 131 | })); |
| 132 | 132 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if ($wikiPath) { |
| 152 | - $out = array_map(function ($url) { |
|
| 152 | + $out = array_map(function($url) { |
|
| 153 | 153 | return str_replace('.svg.png', '.svg', preg_replace('/.*\/18px-/', '', $url)); |
| 154 | 154 | }, $out); |
| 155 | 155 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function numDays(): int |
| 165 | 165 | { |
| 166 | - return (int)(($this->end - $this->start) / 60 / 60 / 24) + 1; |
|
| 166 | + return (int)(($this->end-$this->start) / 60 / 60 / 24)+1; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -253,6 +253,6 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function getNumWithActionsNotInGroup(): int |
| 255 | 255 | { |
| 256 | - return count($this->adminStats) - $this->numWithActions; |
|
| 256 | + return count($this->adminStats)-$this->numWithActions; |
|
| 257 | 257 | } |
| 258 | 258 | } |
@@ -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 | /** |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } elseif ('unblock' === $block['log_action']) { |
| 383 | 383 | // The last block was lifted. So the duration will be the time from when the |
| 384 | 384 | // last block was set to the time of the unblock. |
| 385 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 385 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 386 | 386 | if ($timeSinceLastBlock > $this->longestBlockSeconds) { |
| 387 | 387 | $this->longestBlockSeconds = $timeSinceLastBlock; |
| 388 | 388 | |
@@ -393,8 +393,8 @@ discard block |
||
| 393 | 393 | // The last block was modified. So we will adjust $lastBlock to include |
| 394 | 394 | // the difference of the duration of the new reblock, and time since the last block. |
| 395 | 395 | // $lastBlock is left unchanged if its duration was indefinite. |
| 396 | - $timeSinceLastBlock = $timestamp - $lastBlock[0]; |
|
| 397 | - $lastBlock[1] = $timeSinceLastBlock + $duration; |
|
| 396 | + $timeSinceLastBlock = $timestamp-$lastBlock[0]; |
|
| 397 | + $lastBlock[1] = $timeSinceLastBlock+$duration; |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | // Test if the last block is still active, and if so use the expiry as the duration. |
| 407 | - $lastBlockExpiry = $lastBlock[0] + $lastBlock[1]; |
|
| 407 | + $lastBlockExpiry = $lastBlock[0]+$lastBlock[1]; |
|
| 408 | 408 | if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) { |
| 409 | 409 | $this->longestBlockSeconds = $lastBlock[1]; |
| 410 | 410 | // Otherwise, test if the duration of the last block is now the longest overall. |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | // If invalid, $duration is left as null. |
| 449 | 449 | if (strtotime($durationStr)) { |
| 450 | 450 | $expiry = strtotime($durationStr, $timestamp); |
| 451 | - $duration = $expiry - $timestamp; |
|
| 451 | + $duration = $expiry-$timestamp; |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | return [$timestamp, $duration]; |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | $import = $logCounts['import-import'] ?? 0; |
| 536 | 536 | $interwiki = $logCounts['import-interwiki'] ?? 0; |
| 537 | 537 | $upload = $logCounts['import-upload'] ?? 0; |
| 538 | - return $import + $interwiki + $upload; |
|
| 538 | + return $import+$interwiki+$upload; |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | /** |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | $logCounts = $this->getLogCounts(); |
| 558 | 558 | $new = $logCounts['contentmodel-new'] ?? 0; |
| 559 | 559 | $modified = $logCounts['contentmodel-change'] ?? 0; |
| 560 | - return $new + $modified; |
|
| 560 | + return $new+$modified; |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | /** |
@@ -686,9 +686,9 @@ discard block |
||
| 686 | 686 | public function approvals(): int |
| 687 | 687 | { |
| 688 | 688 | $logCounts = $this->getLogCounts(); |
| 689 | - return (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0) + |
|
| 690 | - (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0) + |
|
| 691 | - (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) + |
|
| 689 | + return (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0)+ |
|
| 690 | + (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0)+ |
|
| 691 | + (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+ |
|
| 692 | 692 | (!empty($logCounts['review-approve2-i']) ? $logCounts['review2-approve-i'] : 0); |
| 693 | 693 | } |
| 694 | 694 | |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | $logCounts = $this->getLogCounts(); |
| 712 | 712 | $create2 = $logCounts['newusers-create2'] ?: 0; |
| 713 | 713 | $byemail = $logCounts['newusers-byemail'] ?: 0; |
| 714 | - return $create2 + $byemail; |
|
| 714 | + return $create2+$byemail; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | /** |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | |
| 814 | 814 | $totals = $this->repository->getMonthCounts($this->project, $this->user); |
| 815 | 815 | $out = [ |
| 816 | - 'yearLabels' => [], // labels for years |
|
| 816 | + 'yearLabels' => [], // labels for years |
|
| 817 | 817 | 'monthLabels' => [], // labels for months |
| 818 | 818 | 'totals' => [], // actual totals, grouped by namespace, year and then month |
| 819 | 819 | ]; |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | $out['totals'][$ns][$total['year']] = []; |
| 908 | 908 | } |
| 909 | 909 | |
| 910 | - $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count']; |
|
| 910 | + $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count']; |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | return [$out, $firstEdit]; |
@@ -924,9 +924,9 @@ discard block |
||
| 924 | 924 | private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange): array |
| 925 | 925 | { |
| 926 | 926 | foreach ($dateRange as $monthObj) { |
| 927 | - $year = (int) $monthObj->format('Y'); |
|
| 927 | + $year = (int)$monthObj->format('Y'); |
|
| 928 | 928 | $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy'); |
| 929 | - $month = (int) $monthObj->format('n'); |
|
| 929 | + $month = (int)$monthObj->format('n'); |
|
| 930 | 930 | $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM'); |
| 931 | 931 | |
| 932 | 932 | // Fill in labels |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | public function countSmallEdits(): int |
| 1071 | 1071 | { |
| 1072 | 1072 | $editSizeData = $this->getEditSizeData(); |
| 1073 | - return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0; |
|
| 1073 | + return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0; |
|
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | /** |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | public function countLargeEdits(): int |
| 1081 | 1081 | { |
| 1082 | 1082 | $editSizeData = $this->getEditSizeData(); |
| 1083 | - return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0; |
|
| 1083 | + return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0; |
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | /** |
@@ -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 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $title = $info['title'] ?? $this->unnormalizedPageName; |
| 125 | 125 | $nsName = $this->getNamespaceName(); |
| 126 | 126 | return $nsName |
| 127 | - ? str_replace($nsName . ':', '', $title) |
|
| 127 | + ? str_replace($nsName.':', '', $title) |
|
| 128 | 128 | : $title; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | { |
| 323 | 323 | $content = $this->repository->getPagesWikitext( |
| 324 | 324 | $this->getProject(), |
| 325 | - [ $this->getTitle() ] |
|
| 325 | + [$this->getTitle()] |
|
| 326 | 326 | ); |
| 327 | 327 | |
| 328 | 328 | return $content[$this->getTitle()] ?? null; |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $wikidataInfo = $this->repository->getWikidataInfo($this); |
| 390 | 390 | |
| 391 | - $terms = array_map(function ($entry) { |
|
| 391 | + $terms = array_map(function($entry) { |
|
| 392 | 392 | return $entry['term']; |
| 393 | 393 | }, $wikidataInfo); |
| 394 | 394 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | 'prio' => 2, |
| 400 | 400 | 'name' => 'Wikidata', |
| 401 | 401 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
| 402 | - 'explanation' => "See: <a target='_blank' " . |
|
| 402 | + 'explanation' => "See: <a target='_blank' ". |
|
| 403 | 403 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
| 404 | 404 | ]; |
| 405 | 405 | } |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | 'prio' => 3, |
| 410 | 410 | 'name' => 'Wikidata', |
| 411 | 411 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
| 412 | - 'explanation' => "See: <a target='_blank' " . |
|
| 412 | + 'explanation' => "See: <a target='_blank' ". |
|
| 413 | 413 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
| 414 | 414 | ]; |
| 415 | 415 | } |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | return 0; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - return array_sum(array_map(function ($item) { |
|
| 490 | + return array_sum(array_map(function($item) { |
|
| 491 | 491 | return (int)$item['views']; |
| 492 | 492 | }, $pageviews['items'])); |
| 493 | 493 | } |
@@ -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 | |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | |
| 959 | 959 | if ($info['all'] > 1) { |
| 960 | 960 | // Number of seconds/days between first and last edit. |
| 961 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
| 961 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
| 962 | 962 | $days = $secs / (60 * 60 * 24); |
| 963 | 963 | |
| 964 | 964 | // Average time between edits (in days). |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | // Loop through again and add percentages. |
| 970 | - $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) { |
|
| 970 | + $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) { |
|
| 971 | 971 | $editor['percentage'] = 100 * ($editor['value'] / $topTenCount); |
| 972 | 972 | return $editor; |
| 973 | 973 | }, $topTenEditorsByEdits); |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | { |
| 986 | 986 | // First sort editors array by the amount of text they added. |
| 987 | 987 | $topTenEditorsByAdded = $this->editors; |
| 988 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
| 988 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
| 989 | 989 | if ($a['added'] === $b['added']) { |
| 990 | 990 | return 0; |
| 991 | 991 | } |
@@ -996,12 +996,12 @@ discard block |
||
| 996 | 996 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
| 997 | 997 | |
| 998 | 998 | // Get the sum of added text so that we can add in percentages. |
| 999 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
| 999 | + $topTenTotalAdded = array_sum(array_map(function($editor) { |
|
| 1000 | 1000 | return $this->editors[$editor]['added']; |
| 1001 | 1001 | }, $topTenEditorsByAdded)); |
| 1002 | 1002 | |
| 1003 | 1003 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
| 1004 | - return array_map(function ($editor) use ($topTenTotalAdded) { |
|
| 1004 | + return array_map(function($editor) use ($topTenTotalAdded) { |
|
| 1005 | 1005 | $added = $this->editors[$editor]['added']; |
| 1006 | 1006 | return [ |
| 1007 | 1007 | 'label' => $editor, |
@@ -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 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $firstDateTime = $this->topEdits[0]->getTimestamp(); |
| 165 | 165 | $lastDateTime = end($this->topEdits)->getTimestamp(); |
| 166 | - $secs = $firstDateTime->getTimestamp() - $lastDateTime->getTimestamp(); |
|
| 166 | + $secs = $firstDateTime->getTimestamp()-$lastDateTime->getTimestamp(); |
|
| 167 | 167 | $days = $secs / (60 * 60 * 24); |
| 168 | 168 | return $days / count($this->topEdits); |
| 169 | 169 | } |
@@ -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 | |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | $firstAddrUnpacked = unpack('H*', $firstAddrBin); |
| 127 | 127 | $firstAddrHex = reset($firstAddrUnpacked); |
| 128 | 128 | $range[0] = inet_ntop($firstAddrBin); |
| 129 | - $flexBits = 128 - $prefixLen; |
|
| 129 | + $flexBits = 128-$prefixLen; |
|
| 130 | 130 | $lastAddrHex = $firstAddrHex; |
| 131 | 131 | |
| 132 | 132 | $pos = 31; |
| 133 | 133 | while ($flexBits > 0) { |
| 134 | 134 | $orig = substr($lastAddrHex, $pos, 1); |
| 135 | 135 | $origVal = hexdec($orig); |
| 136 | - $newVal = $origVal | (pow(2, min(4, $flexBits)) - 1); |
|
| 136 | + $newVal = $origVal | (pow(2, min(4, $flexBits))-1); |
|
| 137 | 137 | $new = dechex($newVal); |
| 138 | 138 | $lastAddrHex = substr_replace($lastAddrHex, $new, $pos, 1); |
| 139 | 139 | $flexBits -= 4; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | $range[1] = inet_ntop($lastAddrBin); |
| 145 | 145 | } else { |
| 146 | 146 | $cidr = explode('/', $this->username); |
| 147 | - $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32 - (int)$cidr[1])); |
|
| 148 | - $range[1] = long2ip(ip2long($range[0]) + pow(2, (32 - (int)$cidr[1])) - 1); |
|
| 147 | + $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32-(int)$cidr[1])); |
|
| 148 | + $range[1] = long2ip(ip2long($range[0])+pow(2, (32-(int)$cidr[1]))-1); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Find the leftmost common characters between the two addresses. |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public function countEdits(Project $project, $namespace = 'all', $start = false, $end = false): int |
| 355 | 355 | { |
| 356 | - return (int) $this->repository->countEdits($project, $this, $namespace, $start, $end); |
|
| 356 | + return (int)$this->repository->countEdits($project, $this, $namespace, $start, $end); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |