@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the DisabledToolSubscriber class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\EventSubscriber; |
9 | 9 |
@@ -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 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
277 | 277 | |
278 | 278 | if ($isSection && isset($page)) { |
279 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
279 | + $pageUrl = $project->getUrl(false).str_replace( |
|
280 | 280 | '$1', |
281 | 281 | $page->getTitle($useUnnormalizedPageTitle), |
282 | 282 | $project->getArticlePath() |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | // Must have underscores for the link to properly go to the section. |
287 | 287 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
288 | 288 | |
289 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
290 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
289 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
290 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
291 | 291 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
292 | 292 | } |
293 | 293 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | ); |
302 | 302 | |
303 | 303 | // Use normalized page title (underscored, capitalized). |
304 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
304 | + $pageUrl = $project->getUrl(false).str_replace( |
|
305 | 305 | '$1', |
306 | 306 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
307 | 307 | $project->getArticlePath() |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | public function getDiffUrl(): string |
340 | 340 | { |
341 | 341 | $project = $this->getProject(); |
342 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
343 | - return rtrim($project->getUrl(), '/') . $path; |
|
342 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
343 | + return rtrim($project->getUrl(), '/').$path; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | public function getPermaUrl(): string |
351 | 351 | { |
352 | 352 | $project = $this->getProject(); |
353 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
354 | - return rtrim($project->getUrl(), '/') . $path; |
|
353 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
354 | + return rtrim($project->getUrl(), '/').$path; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the TopEdits class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Model; |
9 | 9 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $firstDateTime = $this->topEdits[0]->getTimestamp(); |
141 | 141 | $lastDateTime = end($this->topEdits)->getTimestamp(); |
142 | - $secs = $firstDateTime->getTimestamp() - $lastDateTime->getTimestamp(); |
|
142 | + $secs = $firstDateTime->getTimestamp()-$lastDateTime->getTimestamp(); |
|
143 | 143 | $days = $secs / (60 * 60 * 24); |
144 | 144 | return $days / count($this->topEdits); |
145 | 145 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the EditSummary class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Model; |
9 | 9 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the AppExtension class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Twig; |
9 | 9 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | public function requestTime(): float |
111 | 111 | { |
112 | 112 | if (!isset($this->requestTime)) { |
113 | - $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
113 | + $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | return $this->requestTime; |
@@ -676,15 +676,15 @@ discard block |
||
676 | 676 | |
677 | 677 | if ($seconds >= 86400) { |
678 | 678 | // Over a day |
679 | - $val = (int) floor($seconds / 86400); |
|
679 | + $val = (int)floor($seconds / 86400); |
|
680 | 680 | $key = 'days'; |
681 | 681 | } elseif ($seconds >= 3600) { |
682 | 682 | // Over an hour, less than a day |
683 | - $val = (int) floor($seconds / 3600); |
|
683 | + $val = (int)floor($seconds / 3600); |
|
684 | 684 | $key = 'hours'; |
685 | 685 | } elseif ($seconds >= 60) { |
686 | 686 | // Over a minute, less than an hour |
687 | - $val = (int) floor($seconds / 60); |
|
687 | + $val = (int)floor($seconds / 60); |
|
688 | 688 | $key = 'minutes'; |
689 | 689 | } |
690 | 690 |
@@ -156,7 +156,7 @@ |
||
156 | 156 | // Send all to the template. |
157 | 157 | return $this->getFormattedResponse('topedits/result_article', [ |
158 | 158 | 'xtPage' => 'TopEdits', |
159 | - 'xtTitle' => $this->user->getUsername() . ' - ' . $this->page->getTitle(), |
|
159 | + 'xtTitle' => $this->user->getUsername().' - '.$this->page->getTitle(), |
|
160 | 160 | 'project' => $this->project, |
161 | 161 | 'user' => $this->user, |
162 | 162 | 'page' => $this->page, |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $sections = is_array($sectionsQuery) ? $sectionsQuery : explode('|', $sectionsQuery); |
173 | 173 | |
174 | 174 | // Filter out any invalid section IDs. |
175 | - $sections = array_filter($sections, function ($section) { |
|
175 | + $sections = array_filter($sections, function($section) { |
|
176 | 176 | return in_array($section, $this->getSectionNames()); |
177 | 177 | }); |
178 | 178 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | $ret = [ |
245 | - 'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(), |
|
245 | + 'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(), |
|
246 | 246 | 'xtPage' => 'EditCounter', |
247 | 247 | 'user' => $this->user, |
248 | 248 | 'project' => $this->project, |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | $rendered = str_replace('"', '\"', trim($rendered)); |
87 | 87 | |
88 | 88 | // Uglify temporary file. |
89 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
89 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
90 | 90 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
91 | 91 | $script .= $this->get('kernel')->getProjectDir(). |
92 | - "/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
92 | + "/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
93 | 93 | "&& rm $tmpFile >/dev/null"; |
94 | 94 | $process = new Process($script); |
95 | 95 | $process->run(); |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | $rendered = str_replace('\"', '"', trim($rendered)); |
109 | 109 | |
110 | 110 | // Add comment after uglifying since it removes comments. |
111 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
112 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
113 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
114 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
111 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
112 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
113 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
114 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $response = new Response($rendered); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $data = [ |
268 | 268 | 'project' => $project->getDomain(), |
269 | 269 | 'page' => $page->getTitle(), |
270 | - 'watchers' => (int) $page->getWatchers(), |
|
270 | + 'watchers' => (int)$page->getWatchers(), |
|
271 | 271 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
272 | 272 | 'pageviews_offset' => $pageviewsOffset, |
273 | 273 | ]; |
@@ -290,22 +290,22 @@ discard block |
||
290 | 290 | if (false !== $info) { |
291 | 291 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
292 | 292 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
293 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
293 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
294 | 294 | |
295 | 295 | $assessment = $page->getProject() |
296 | 296 | ->getPageAssessments() |
297 | 297 | ->getAssessment($page); |
298 | 298 | |
299 | 299 | $data = array_merge($data, [ |
300 | - 'revisions' => (int) $info['num_edits'], |
|
301 | - 'editors' => (int) $info['num_editors'], |
|
300 | + 'revisions' => (int)$info['num_edits'], |
|
301 | + 'editors' => (int)$info['num_editors'], |
|
302 | 302 | 'author' => $info['author'], |
303 | - 'author_editcount' => (int) $info['author_editcount'], |
|
303 | + 'author_editcount' => (int)$info['author_editcount'], |
|
304 | 304 | 'created_at' => $creationDateTime->format('Y-m-d'), |
305 | 305 | 'created_rev_id' => $info['created_rev_id'], |
306 | 306 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
307 | 307 | 'secs_since_last_edit' => $secsSinceLastEdit, |
308 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
308 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
309 | 309 | 'assessment' => $assessment, |
310 | 310 | ]); |
311 | 311 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the UserRightsRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | return $this->cache->getItem($cacheKey)->get(); |
135 | 135 | } |
136 | 136 | |
137 | - $rightsPaths = array_map(function ($right) { |
|
137 | + $rightsPaths = array_map(function($right) { |
|
138 | 138 | return "Group-$right-member"; |
139 | 139 | }, $this->getRawRightsNames($project)); |
140 | 140 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | FROM $revisionTable |
273 | 273 | WHERE rev_user = :userId |
274 | 274 | AND rev_timestamp >= $offset |
275 | - LIMIT 1 OFFSET ".($edits - 1); |
|
275 | + LIMIT 1 OFFSET ".($edits-1); |
|
276 | 276 | |
277 | 277 | $ret = $this->executeProjectsQuery($sql, [ |
278 | 278 | 'userId' => $user->getId($project), |