@@ -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 AppBundle\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 |
@@ -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 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $refs = $crawler->filter('#mw-content-text .reference'); |
150 | 150 | $refContent = []; |
151 | - $refs->each(function ($ref) use (&$refContent): void { |
|
151 | + $refs->each(function($ref) use (&$refContent): void { |
|
152 | 152 | $refContent[] = $ref->text(); |
153 | 153 | }); |
154 | 154 | $uniqueRefs = count(array_unique($refContent)); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $totalChars = 0; |
177 | 177 | $totalWords = 0; |
178 | 178 | $paragraphs = $crawler->filter($selector); |
179 | - $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void { |
|
179 | + $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void { |
|
180 | 180 | /** @var Crawler $node */ |
181 | 181 | $text = preg_replace('/\[\d+]/', '', trim($node->text(null, true))); |
182 | 182 | $totalChars += strlen($text); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $data = [ |
241 | 241 | 'project' => $project->getDomain(), |
242 | 242 | 'page' => $page->getTitle(), |
243 | - 'watchers' => (int) $page->getWatchers(), |
|
243 | + 'watchers' => (int)$page->getWatchers(), |
|
244 | 244 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
245 | 245 | 'pageviews_offset' => $pageviewsOffset, |
246 | 246 | ]; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | if (false !== $info) { |
266 | 266 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
267 | 267 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
268 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
268 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
269 | 269 | |
270 | 270 | // Some wikis (such foundation.wikimedia.org) may be missing the creation date. |
271 | 271 | $creationDateTime = false === $creationDateTime |
@@ -277,16 +277,16 @@ discard block |
||
277 | 277 | ->getAssessment($page); |
278 | 278 | |
279 | 279 | $data = array_merge($data, [ |
280 | - 'revisions' => (int) $info['num_edits'], |
|
281 | - 'editors' => (int) $info['num_editors'], |
|
282 | - 'minor_edits' => (int) $info['minor_edits'], |
|
280 | + 'revisions' => (int)$info['num_edits'], |
|
281 | + 'editors' => (int)$info['num_editors'], |
|
282 | + 'minor_edits' => (int)$info['minor_edits'], |
|
283 | 283 | 'author' => $info['author'], |
284 | - 'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'], |
|
284 | + 'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'], |
|
285 | 285 | 'created_at' => $creationDateTime, |
286 | 286 | 'created_rev_id' => $info['created_rev_id'], |
287 | 287 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
288 | 288 | 'secs_since_last_edit' => $secsSinceLastEdit, |
289 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
289 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
290 | 290 | 'assessment' => $assessment, |
291 | 291 | ]); |
292 | 292 | } |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | } |
437 | 437 | |
438 | 438 | // Sort by edit count. |
439 | - uasort($this->bots, function ($a, $b) { |
|
440 | - return $b['count'] - $a['count']; |
|
439 | + uasort($this->bots, function($a, $b) { |
|
440 | + return $b['count']-$a['count']; |
|
441 | 441 | }); |
442 | 442 | |
443 | 443 | return $this->bots; |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | $rendered = str_replace('"', '\"', trim($rendered)); |
104 | 104 | |
105 | 105 | // Uglify temporary file. |
106 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
106 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
107 | 107 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
108 | 108 | $script .= $this->get('kernel')->getProjectDir(). |
109 | - "/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
109 | + "/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
110 | 110 | "&& rm $tmpFile >/dev/null"; |
111 | 111 | $process = Process::fromShellCommandline($script); |
112 | 112 | $process->run(); |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $rendered = str_replace('\"', '"', trim($rendered)); |
125 | 125 | |
126 | 126 | // Add comment after uglifying since it removes comments. |
127 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
128 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
129 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
130 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
127 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
128 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
129 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
130 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | $response = new Response($rendered); |