@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace AppBundle\Model; |
| 5 | 5 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function getMaxRevisions(): int |
| 90 | 90 | { |
| 91 | 91 | if (!isset($this->maxRevisions)) { |
| 92 | - $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions'); |
|
| 92 | + $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions'); |
|
| 93 | 93 | } |
| 94 | 94 | return $this->maxRevisions; |
| 95 | 95 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $refs = $crawler->filter('#mw-content-text .reference'); |
| 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)); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $totalChars = 0; |
| 198 | 198 | $totalWords = 0; |
| 199 | 199 | $paragraphs = $crawler->filter($selector); |
| 200 | - $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void { |
|
| 200 | + $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void { |
|
| 201 | 201 | /** @var Crawler $node */ |
| 202 | 202 | $text = preg_replace('/\[\d+]/', '', trim($node->text(null, true))); |
| 203 | 203 | $totalChars += strlen($text); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $data = [ |
| 262 | 262 | 'project' => $project->getDomain(), |
| 263 | 263 | 'page' => $page->getTitle(), |
| 264 | - 'watchers' => (int) $page->getWatchers(), |
|
| 264 | + 'watchers' => (int)$page->getWatchers(), |
|
| 265 | 265 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
| 266 | 266 | 'pageviews_offset' => $pageviewsOffset, |
| 267 | 267 | ]; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | if (false !== $info) { |
| 287 | 287 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
| 288 | 288 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
| 289 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
| 289 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
| 290 | 290 | |
| 291 | 291 | // Some wikis (such foundation.wikimedia.org) may be missing the creation date. |
| 292 | 292 | $creationDateTime = false === $creationDateTime |
@@ -298,16 +298,16 @@ discard block |
||
| 298 | 298 | ->getAssessment($page); |
| 299 | 299 | |
| 300 | 300 | $data = array_merge($data, [ |
| 301 | - 'revisions' => (int) $info['num_edits'], |
|
| 302 | - 'editors' => (int) $info['num_editors'], |
|
| 303 | - 'minor_edits' => (int) $info['minor_edits'], |
|
| 301 | + 'revisions' => (int)$info['num_edits'], |
|
| 302 | + 'editors' => (int)$info['num_editors'], |
|
| 303 | + 'minor_edits' => (int)$info['minor_edits'], |
|
| 304 | 304 | 'author' => $info['author'], |
| 305 | - 'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'], |
|
| 305 | + 'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'], |
|
| 306 | 306 | 'created_at' => $creationDateTime, |
| 307 | 307 | 'created_rev_id' => $info['created_rev_id'], |
| 308 | 308 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
| 309 | 309 | 'secs_since_last_edit' => $secsSinceLastEdit, |
| 310 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
| 310 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
| 311 | 311 | 'assessment' => $assessment, |
| 312 | 312 | ]); |
| 313 | 313 | } |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | // Sort by edit count. |
| 462 | - uasort($this->bots, function ($a, $b) { |
|
| 463 | - return $b['count'] - $a['count']; |
|
| 462 | + uasort($this->bots, function($a, $b) { |
|
| 463 | + return $b['count']-$a['count']; |
|
| 464 | 464 | }); |
| 465 | 465 | |
| 466 | 466 | return $this->bots; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the ArticleInfo class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | |
| 976 | 976 | if ($info['all'] > 1) { |
| 977 | 977 | // Number of seconds/days between first and last edit. |
| 978 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
| 978 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
| 979 | 979 | $days = $secs / (60 * 60 * 24); |
| 980 | 980 | |
| 981 | 981 | // Average time between edits (in days). |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | // Loop through again and add percentages. |
| 987 | - $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) { |
|
| 987 | + $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) { |
|
| 988 | 988 | $editor['percentage'] = 100 * ($editor['value'] / $topTenCount); |
| 989 | 989 | return $editor; |
| 990 | 990 | }, $topTenEditorsByEdits); |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | { |
| 1003 | 1003 | // First sort editors array by the amount of text they added. |
| 1004 | 1004 | $topTenEditorsByAdded = $this->editors; |
| 1005 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
| 1005 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
| 1006 | 1006 | if ($a['added'] === $b['added']) { |
| 1007 | 1007 | return 0; |
| 1008 | 1008 | } |
@@ -1013,12 +1013,12 @@ discard block |
||
| 1013 | 1013 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
| 1014 | 1014 | |
| 1015 | 1015 | // Get the sum of added text so that we can add in percentages. |
| 1016 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
| 1016 | + $topTenTotalAdded = array_sum(array_map(function($editor) { |
|
| 1017 | 1017 | return $this->editors[$editor]['added']; |
| 1018 | 1018 | }, $topTenEditorsByAdded)); |
| 1019 | 1019 | |
| 1020 | 1020 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
| 1021 | - return array_map(function ($editor) use ($topTenTotalAdded) { |
|
| 1021 | + return array_map(function($editor) use ($topTenTotalAdded) { |
|
| 1022 | 1022 | $added = $this->editors[$editor]['added']; |
| 1023 | 1023 | return [ |
| 1024 | 1024 | 'label' => $editor, |