@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace AppBundle\Twig; |
| 5 | 5 | |
@@ -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 AppBundle\Model; |
| 9 | 9 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | public function getMaxRevisions(): int |
| 236 | 236 | { |
| 237 | 237 | if (!isset($this->maxRevisions)) { |
| 238 | - $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions'); |
|
| 238 | + $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions'); |
|
| 239 | 239 | } |
| 240 | 240 | return $this->maxRevisions; |
| 241 | 241 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | $this->yearMonthCounts[$editYear]['all']++; |
| 1012 | 1012 | $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']++; |
| 1013 | 1013 | // This will ultimately be the size of the page by the end of the year |
| 1014 | - $this->yearMonthCounts[$editYear]['size'] = (int) $edit->getLength(); |
|
| 1014 | + $this->yearMonthCounts[$editYear]['size'] = (int)$edit->getLength(); |
|
| 1015 | 1015 | |
| 1016 | 1016 | // Keep track of which month had the most edits |
| 1017 | 1017 | $editsThisMonth = $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']; |
@@ -1172,8 +1172,8 @@ discard block |
||
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | // Sort by edit count. |
| 1175 | - uasort($bots, function ($a, $b) { |
|
| 1176 | - return $b['count'] - $a['count']; |
|
| 1175 | + uasort($bots, function($a, $b) { |
|
| 1176 | + return $b['count']-$a['count']; |
|
| 1177 | 1177 | }); |
| 1178 | 1178 | |
| 1179 | 1179 | $this->bots = $bots; |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | |
| 1283 | 1283 | if ($info['all'] > 1) { |
| 1284 | 1284 | // Number of seconds/days between first and last edit. |
| 1285 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
| 1285 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
| 1286 | 1286 | $days = $secs / (60 * 60 * 24); |
| 1287 | 1287 | |
| 1288 | 1288 | // Average time between edits (in days). |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | 1293 | // Loop through again and add percentages. |
| 1294 | - $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) { |
|
| 1294 | + $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) { |
|
| 1295 | 1295 | $editor['percentage'] = 100 * ($editor['value'] / $topTenCount); |
| 1296 | 1296 | return $editor; |
| 1297 | 1297 | }, $topTenEditorsByEdits); |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | { |
| 1310 | 1310 | // First sort editors array by the amount of text they added. |
| 1311 | 1311 | $topTenEditorsByAdded = $this->editors; |
| 1312 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
| 1312 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
| 1313 | 1313 | if ($a['added'] === $b['added']) { |
| 1314 | 1314 | return 0; |
| 1315 | 1315 | } |
@@ -1320,12 +1320,12 @@ discard block |
||
| 1320 | 1320 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
| 1321 | 1321 | |
| 1322 | 1322 | // Get the sum of added text so that we can add in percentages. |
| 1323 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
| 1323 | + $topTenTotalAdded = array_sum(array_map(function($editor) { |
|
| 1324 | 1324 | return $this->editors[$editor]['added']; |
| 1325 | 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 | - return array_map(function ($editor) use ($topTenTotalAdded) { |
|
| 1328 | + return array_map(function($editor) use ($topTenTotalAdded) { |
|
| 1329 | 1329 | $added = $this->editors[$editor]['added']; |
| 1330 | 1330 | return [ |
| 1331 | 1331 | 'label' => $editor, |
@@ -1356,7 +1356,7 @@ discard block |
||
| 1356 | 1356 | |
| 1357 | 1357 | $refs = $crawler->filter('#mw-content-text .reference'); |
| 1358 | 1358 | $refContent = []; |
| 1359 | - $refs->each(function ($ref) use (&$refContent): void { |
|
| 1359 | + $refs->each(function($ref) use (&$refContent): void { |
|
| 1360 | 1360 | $refContent[] = $ref->text(); |
| 1361 | 1361 | }); |
| 1362 | 1362 | $uniqueRefs = count(array_unique($refContent)); |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | $totalChars = 0; |
| 1385 | 1385 | $totalWords = 0; |
| 1386 | 1386 | $paragraphs = $crawler->filter($selector); |
| 1387 | - $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void { |
|
| 1387 | + $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void { |
|
| 1388 | 1388 | $text = preg_replace('/\[\d+\]/', '', trim($node->text())); |
| 1389 | 1389 | $totalChars += strlen($text); |
| 1390 | 1390 | $totalWords += count(explode(' ', $text)); |