@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the TopEditsRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Repository; |
9 | 9 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments() && 0 === $namespace; |
66 | 66 | $paTable = $project->getTableName('page_assessments'); |
67 | 67 | $paSelect = $hasPageAssessments |
68 | - ? ", ( |
|
68 | + ? ", ( |
|
69 | 69 | SELECT pa_class |
70 | 70 | FROM $paTable |
71 | 71 | WHERE pa_page_id = page_id |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments(); |
180 | 180 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
181 | 181 | $paSelect = $hasPageAssessments |
182 | - ? ", ( |
|
182 | + ? ", ( |
|
183 | 183 | SELECT pa_class |
184 | 184 | FROM $pageAssessmentsTable |
185 | 185 | WHERE pa_page_id = e.page_id |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the Model class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the Page class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $title = $info['title'] ?? $this->unnormalizedPageName; |
127 | 127 | $nsName = $this->getNamespaceName(); |
128 | 128 | return $nsName |
129 | - ? str_replace($nsName . ':', '', $title) |
|
129 | + ? str_replace($nsName.':', '', $title) |
|
130 | 130 | : $title; |
131 | 131 | } |
132 | 132 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | { |
333 | 333 | $content = $this->getRepository()->getPagesWikitext( |
334 | 334 | $this->getProject(), |
335 | - [ $this->getTitle() ] |
|
335 | + [$this->getTitle()] |
|
336 | 336 | ); |
337 | 337 | |
338 | 338 | return $content[$this->getTitle()] ?? null; |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | |
399 | 399 | $wikidataInfo = $this->getRepository()->getWikidataInfo($this); |
400 | 400 | |
401 | - $terms = array_map(function ($entry) { |
|
401 | + $terms = array_map(function($entry) { |
|
402 | 402 | return $entry['term']; |
403 | 403 | }, $wikidataInfo); |
404 | 404 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | 'prio' => 2, |
410 | 410 | 'name' => 'Wikidata', |
411 | 411 | 'notice' => "Label 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:Label'>Help:Label</a>", |
414 | 414 | ]; |
415 | 415 | } |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | 'prio' => 3, |
420 | 420 | 'name' => 'Wikidata', |
421 | 421 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
422 | - 'explanation' => "See: <a target='_blank' " . |
|
422 | + 'explanation' => "See: <a target='_blank' ". |
|
423 | 423 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
424 | 424 | ]; |
425 | 425 | } |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | return 0; |
498 | 498 | } |
499 | 499 | |
500 | - return array_sum(array_map(function ($item) { |
|
500 | + return array_sum(array_map(function($item) { |
|
501 | 501 | return (int)$item['views']; |
502 | 502 | }, $pageviews['items'])); |
503 | 503 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the AdminStats class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $stats = $this->groupStatsByUsername($stats); |
97 | 97 | |
98 | 98 | // Resort, as for some reason the SQL doesn't do this properly. |
99 | - uasort($stats, function ($a, $b) { |
|
99 | + uasort($stats, function($a, $b) { |
|
100 | 100 | if ($a['total'] === $b['total']) { |
101 | 101 | return 0; |
102 | 102 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->usersAndGroups = $this->project->getUsersInGroups($groupUserGroups['local'], $groupUserGroups['global']); |
128 | 128 | |
129 | 129 | // Populate $this->usersInGroup with users who are in the relevant user group for $this->group. |
130 | - $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function ($groups) { |
|
130 | + $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function($groups) { |
|
131 | 131 | return in_array($this->getRelevantUserGroup(), $groups); |
132 | 132 | })); |
133 | 133 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | if ($wikiPath) { |
153 | - $out = array_map(function ($url) { |
|
153 | + $out = array_map(function($url) { |
|
154 | 154 | return str_replace('.svg.png', '.svg', preg_replace('/.*\/18px-/', '', $url)); |
155 | 155 | }, $out); |
156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function numDays(): int |
166 | 166 | { |
167 | - return (int)(($this->end - $this->start) / 60 / 60 / 24) + 1; |
|
167 | + return (int)(($this->end-$this->start) / 60 / 60 / 24)+1; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -254,6 +254,6 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function getNumWithActionsNotInGroup(): int |
256 | 256 | { |
257 | - return count($this->adminStats) - $this->numWithActions; |
|
257 | + return count($this->adminStats)-$this->numWithActions; |
|
258 | 258 | } |
259 | 259 | } |
@@ -1319,10 +1319,10 @@ |
||
1319 | 1319 | // Slice to the top 10. |
1320 | 1320 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
1321 | 1321 | |
1322 | - // Get the sum of added text so that we can add in percentages. |
|
1323 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
1324 | - return $this->editors[$editor]['added']; |
|
1325 | - }, $topTenEditorsByAdded)); |
|
1322 | + // Get the sum of added text so that we can add in percentages. |
|
1323 | + $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
1324 | + return $this->editors[$editor]['added']; |
|
1325 | + }, $topTenEditorsByAdded)); |
|
1326 | 1326 | |
1327 | 1327 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
1328 | 1328 | return array_map(function ($editor) use ($topTenTotalAdded) { |
@@ -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 App\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, |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the PageAssessments class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Model; |
5 | 5 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function getMaxRevisions(): int |
93 | 93 | { |
94 | 94 | if (!isset($this->maxRevisions)) { |
95 | - $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions'); |
|
95 | + $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions'); |
|
96 | 96 | } |
97 | 97 | return $this->maxRevisions; |
98 | 98 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | $refs = $crawler->filter('#mw-content-text .reference'); |
174 | 174 | $refContent = []; |
175 | - $refs->each(function ($ref) use (&$refContent): void { |
|
175 | + $refs->each(function($ref) use (&$refContent): void { |
|
176 | 176 | $refContent[] = $ref->text(); |
177 | 177 | }); |
178 | 178 | $uniqueRefs = count(array_unique($refContent)); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $totalChars = 0; |
201 | 201 | $totalWords = 0; |
202 | 202 | $paragraphs = $crawler->filter($selector); |
203 | - $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void { |
|
203 | + $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void { |
|
204 | 204 | /** @var Crawler $node */ |
205 | 205 | $text = preg_replace('/\[\d+]/', '', trim($node->text(null, true))); |
206 | 206 | $totalChars += strlen($text); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $data = [ |
265 | 265 | 'project' => $project->getDomain(), |
266 | 266 | 'page' => $page->getTitle(), |
267 | - 'watchers' => (int) $page->getWatchers(), |
|
267 | + 'watchers' => (int)$page->getWatchers(), |
|
268 | 268 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
269 | 269 | 'pageviews_offset' => $pageviewsOffset, |
270 | 270 | ]; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | if (false !== $info) { |
290 | 290 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
291 | 291 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
292 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
292 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
293 | 293 | |
294 | 294 | // Some wikis (such foundation.wikimedia.org) may be missing the creation date. |
295 | 295 | $creationDateTime = false === $creationDateTime |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | ->getAssessment($page); |
302 | 302 | |
303 | 303 | $data = array_merge($data, [ |
304 | - 'revisions' => (int) $info['num_edits'], |
|
305 | - 'editors' => (int) $info['num_editors'], |
|
306 | - 'minor_edits' => (int) $info['minor_edits'], |
|
304 | + 'revisions' => (int)$info['num_edits'], |
|
305 | + 'editors' => (int)$info['num_editors'], |
|
306 | + 'minor_edits' => (int)$info['minor_edits'], |
|
307 | 307 | 'author' => $info['author'], |
308 | - 'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'], |
|
308 | + 'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'], |
|
309 | 309 | 'created_at' => $creationDateTime, |
310 | 310 | 'created_rev_id' => $info['created_rev_id'], |
311 | 311 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
312 | 312 | 'secs_since_last_edit' => $secsSinceLastEdit, |
313 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
313 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
314 | 314 | 'assessment' => $assessment, |
315 | 315 | ]); |
316 | 316 | } |
@@ -462,8 +462,8 @@ discard block |
||
462 | 462 | } |
463 | 463 | |
464 | 464 | // Sort by edit count. |
465 | - uasort($this->bots, function ($a, $b) { |
|
466 | - return $b['count'] - $a['count']; |
|
465 | + uasort($this->bots, function($a, $b) { |
|
466 | + return $b['count']-$a['count']; |
|
467 | 467 | }); |
468 | 468 | |
469 | 469 | return $this->bots; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\DoctrineMigrations; |
5 | 5 |
@@ -20,4 +20,4 @@ |
||
20 | 20 | $_SERVER += $_ENV; |
21 | 21 | $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; |
22 | 22 | $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; |
23 | -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; |
|
23 | +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int)$_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; |