@@ -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 = new Process([$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); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the Edit class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public static function getEditsFromRevs(Project $project, User $user, array $revs): array |
| 88 | 88 | { |
| 89 | - return array_map(function ($rev) use ($project, $user) { |
|
| 89 | + return array_map(function($rev) use ($project, $user) { |
|
| 90 | 90 | /** @var Page $page Page object to be passed to the Edit constructor. */ |
| 91 | 91 | $page = Page::newFromRev($project, $rev); |
| 92 | 92 | $rev['user'] = $user; |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
| 300 | 300 | |
| 301 | 301 | if ($isSection && isset($page)) { |
| 302 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 302 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 303 | 303 | '$1', |
| 304 | 304 | $page->getTitle($useUnnormalizedPageTitle), |
| 305 | 305 | $project->getArticlePath() |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | // Must have underscores for the link to properly go to the section. |
| 310 | 310 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
| 311 | 311 | |
| 312 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
| 313 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
| 312 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
| 313 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
| 314 | 314 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | ); |
| 325 | 325 | |
| 326 | 326 | // Use normalized page title (underscored, capitalized). |
| 327 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 327 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 328 | 328 | '$1', |
| 329 | 329 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
| 330 | 330 | $project->getArticlePath() |
@@ -362,8 +362,8 @@ discard block |
||
| 362 | 362 | public function getDiffUrl(): string |
| 363 | 363 | { |
| 364 | 364 | $project = $this->getProject(); |
| 365 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
| 366 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 365 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
| 366 | + return rtrim($project->getUrl(), '/').$path; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
@@ -373,8 +373,8 @@ discard block |
||
| 373 | 373 | public function getPermaUrl(): string |
| 374 | 374 | { |
| 375 | 375 | $project = $this->getProject(); |
| 376 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
| 377 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 376 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
| 377 | + return rtrim($project->getUrl(), '/').$path; |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the CategoryEdits class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ) { |
| 47 | 47 | $this->project = $project; |
| 48 | 48 | $this->user = $user; |
| 49 | - $this->categories = array_map(function ($category) { |
|
| 49 | + $this->categories = array_map(function($category) { |
|
| 50 | 50 | return str_replace(' ', '_', $category); |
| 51 | 51 | }, $categories); |
| 52 | 52 | $this->start = false === $start ? '' : date('Y-m-d', $start); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function getCategoriesNormalized(): array |
| 80 | 80 | { |
| 81 | - return array_map(function ($category) { |
|
| 81 | + return array_map(function($category) { |
|
| 82 | 82 | return str_replace('_', ' ', $category); |
| 83 | 83 | }, $this->categories); |
| 84 | 84 | } |
@@ -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 AppBundle\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); |
|
| 167 | + return (int)(($this->end-$this->start) / 60 / 60 / 24); |
|
| 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 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the AutoEdits class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | public function getToolsTotal(): int |
| 226 | 226 | { |
| 227 | 227 | if (!is_int($this->toolsTotal)) { |
| 228 | - $this->toolsTotal = array_reduce($this->getToolCounts(), function ($a, $b) { |
|
| 229 | - return $a + $b['count']; |
|
| 228 | + $this->toolsTotal = array_reduce($this->getToolCounts(), function($a, $b) { |
|
| 229 | + return $a+$b['count']; |
|
| 230 | 230 | }); |
| 231 | 231 | } |
| 232 | 232 | |