@@ -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 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | [$bytes, $chars, $words] = $this->countCharsAndWords($crawler); |
| 170 | 170 | |
| 171 | 171 | $refContent = []; |
| 172 | - $refs->each(function ($ref) use (&$refContent): void { |
|
| 172 | + $refs->each(function($ref) use (&$refContent): void { |
|
| 173 | 173 | $refContent[] = $ref->text(); |
| 174 | 174 | }); |
| 175 | 175 | $uniqueRefs = count(array_unique($refContent)); |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | '[typeof~="mw:Extension/templatestyles"]', |
| 205 | 205 | '[typeof~="mw:Extension/math"]', |
| 206 | 206 | '[typeof~="mw:Extension/ref"]', |
| 207 | - ]))->each(function (Crawler $subCrawler) { |
|
| 207 | + ]))->each(function(Crawler $subCrawler) { |
|
| 208 | 208 | foreach ($subCrawler as $subNode) { |
| 209 | 209 | $subNode->parentNode->removeChild($subNode); |
| 210 | 210 | } |
| 211 | 211 | }); |
| 212 | 212 | |
| 213 | - $paragraphs->each(function ($node) use (&$totalBytes, &$totalChars, &$totalWords): void { |
|
| 213 | + $paragraphs->each(function($node) use (&$totalBytes, &$totalChars, &$totalWords): void { |
|
| 214 | 214 | /** @var Crawler $node */ |
| 215 | 215 | $text = $node->text(); |
| 216 | 216 | $totalBytes += strlen($text); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $data = [ |
| 276 | 276 | 'project' => $project->getDomain(), |
| 277 | 277 | 'page' => $page->getTitle(), |
| 278 | - 'watchers' => (int) $page->getWatchers(), |
|
| 278 | + 'watchers' => (int)$page->getWatchers(), |
|
| 279 | 279 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
| 280 | 280 | 'pageviews_offset' => $pageviewsOffset, |
| 281 | 281 | ]; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | if ($info) { |
| 299 | 299 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
| 300 | 300 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
| 301 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
| 301 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
| 302 | 302 | |
| 303 | 303 | // Some wikis (such foundation.wikimedia.org) may be missing the creation date. |
| 304 | 304 | $creationDateTime = false === $creationDateTime |
@@ -310,16 +310,16 @@ discard block |
||
| 310 | 310 | ->getAssessment($page); |
| 311 | 311 | |
| 312 | 312 | $data = array_merge($data, [ |
| 313 | - 'revisions' => (int) $info['num_edits'], |
|
| 314 | - 'editors' => (int) $info['num_editors'], |
|
| 315 | - 'minor_edits' => (int) $info['minor_edits'], |
|
| 313 | + 'revisions' => (int)$info['num_edits'], |
|
| 314 | + 'editors' => (int)$info['num_editors'], |
|
| 315 | + 'minor_edits' => (int)$info['minor_edits'], |
|
| 316 | 316 | 'author' => $info['author'], |
| 317 | - 'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'], |
|
| 317 | + 'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'], |
|
| 318 | 318 | 'created_at' => $creationDateTime, |
| 319 | 319 | 'created_rev_id' => $info['created_rev_id'], |
| 320 | 320 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
| 321 | 321 | 'secs_since_last_edit' => $secsSinceLastEdit, |
| 322 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
| 322 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
| 323 | 323 | 'assessment' => $assessment, |
| 324 | 324 | ]); |
| 325 | 325 | } |
@@ -469,8 +469,8 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | // Sort by edit count. |
| 472 | - uasort($this->bots, function ($a, $b) { |
|
| 473 | - return $b['count'] - $a['count']; |
|
| 472 | + uasort($this->bots, function($a, $b) { |
|
| 473 | + return $b['count']-$a['count']; |
|
| 474 | 474 | }); |
| 475 | 475 | |
| 476 | 476 | return $this->bots; |
@@ -264,7 +264,7 @@ |
||
| 264 | 264 | ): JsonResponse { |
| 265 | 265 | $this->recordApiUsage('page/prose'); |
| 266 | 266 | $this->setupArticleInfo($articleInfoRepo, $autoEditsHelper); |
| 267 | - $this->addFlash('info', 'The algorithm used by this API has recently changed. ' . |
|
| 267 | + $this->addFlash('info', 'The algorithm used by this API has recently changed. '. |
|
| 268 | 268 | 'See https://www.mediawiki.org/wiki/XTools/Page_History#Prose for details.'); |
| 269 | 269 | return $this->getFormattedApiResponse($this->articleInfo->getProseStats()); |
| 270 | 270 | } |