@@ -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 | |
@@ -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, |
@@ -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\Controller; |
5 | 5 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $this->project = $defaultProject; |
192 | 192 | |
193 | 193 | $results = $globalContribs->globalEdits(); |
194 | - $results = array_map(function (Edit $edit) { |
|
194 | + $results = array_map(function(Edit $edit) { |
|
195 | 195 | return $edit->getForJson(true, true); |
196 | 196 | }, array_values($results)); |
197 | 197 | $results = $this->addFullPageTitlesAndContinue('globalcontribs', [], $results); |
@@ -272,7 +272,7 @@ |
||
272 | 272 | 'total_editcount' => $this->autoEdits->getEditCount(), |
273 | 273 | 'automated_editcount' => $this->autoEdits->getAutomatedCount(), |
274 | 274 | ]; |
275 | - $ret['nonautomated_editcount'] = $ret['total_editcount'] - $ret['automated_editcount']; |
|
275 | + $ret['nonautomated_editcount'] = $ret['total_editcount']-$ret['automated_editcount']; |
|
276 | 276 | |
277 | 277 | if (isset($this->params['tools'])) { |
278 | 278 | $tools = $this->autoEdits->getToolCounts(); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | throw new XtoolsHttpException( |
218 | 218 | $this->i18n->msg('not-opted-in', [ |
219 | 219 | $this->getOptedInPage()->getTitle(), |
220 | - $this->i18n->msg('not-opted-in-link') . |
|
220 | + $this->i18n->msg('not-opted-in-link'). |
|
221 | 221 | ' <https://www.mediawiki.org/wiki/XTools/Edit_Counter#restricted_stats>', |
222 | 222 | $this->i18n->msg('not-opted-in-login'), |
223 | 223 | ]), |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * Set cookies on the given Response. |
264 | 264 | * @param Response $response |
265 | 265 | */ |
266 | - private function setCookies(Response &$response): void |
|
266 | + private function setCookies(Response & $response): void |
|
267 | 267 | { |
268 | 268 | // Not done for subrequests. |
269 | 269 | if ($this->isSubRequest) { |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | $params = $this->convertLegacyParams($params); |
664 | 664 | |
665 | 665 | // Remove blank values. |
666 | - return array_filter($params, function ($param) { |
|
666 | + return array_filter($params, function($param) { |
|
667 | 667 | // 'namespace' or 'username' could be '0'. |
668 | 668 | return null !== $param && '' !== $param; |
669 | 669 | }); |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | } |
865 | 865 | |
866 | 866 | $elapsedTime = round( |
867 | - microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT'), |
|
867 | + microtime(true)-$this->request->server->get('REQUEST_TIME_FLOAT'), |
|
868 | 868 | 3 |
869 | 869 | ); |
870 | 870 | |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array |
906 | 906 | { |
907 | 907 | // Add full_page_title (in addition to the existing page_title and page_namespace keys). |
908 | - $out[$key] = array_map(function ($rev) { |
|
908 | + $out[$key] = array_map(function($rev) { |
|
909 | 909 | return array_merge([ |
910 | 910 | 'full_page_title' => $this->getPageFromNsAndTitle( |
911 | 911 | (int)$rev['page_namespace'], |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | $conn = $this->container->get('doctrine') |
942 | 942 | ->getManager('default') |
943 | 943 | ->getConnection(); |
944 | - $date = date('Y-m-d'); |
|
944 | + $date = date('Y-m-d'); |
|
945 | 945 | |
946 | 946 | // Increment count in timeline |
947 | 947 | $existsSql = "SELECT 1 FROM usage_api_timeline |
@@ -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::newFromRow($project, $rev); |
92 | 92 | $rev['user'] = $user; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
309 | 309 | |
310 | 310 | if ($isSection && isset($page)) { |
311 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
311 | + $pageUrl = $project->getUrl(false).str_replace( |
|
312 | 312 | '$1', |
313 | 313 | $page->getTitle($useUnnormalizedPageTitle), |
314 | 314 | $project->getArticlePath() |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | // Must have underscores for the link to properly go to the section. |
319 | 319 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
320 | 320 | |
321 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
322 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
321 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
322 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
323 | 323 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
324 | 324 | } |
325 | 325 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | ); |
334 | 334 | |
335 | 335 | // Use normalized page title (underscored, capitalized). |
336 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
336 | + $pageUrl = $project->getUrl(false).str_replace( |
|
337 | 337 | '$1', |
338 | 338 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
339 | 339 | $project->getArticlePath() |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | public function getDiffUrl(): string |
372 | 372 | { |
373 | 373 | $project = $this->getProject(); |
374 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
375 | - return rtrim($project->getUrl(), '/') . $path; |
|
374 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
375 | + return rtrim($project->getUrl(), '/').$path; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | public function getPermaUrl(): string |
383 | 383 | { |
384 | 384 | $project = $this->getProject(); |
385 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
386 | - return rtrim($project->getUrl(), '/') . $path; |
|
385 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
386 | + return rtrim($project->getUrl(), '/').$path; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | $ret['reverted'] = $this->reverted; |
467 | 467 | } |
468 | 468 | if ($includeUsername) { |
469 | - $ret = [ 'username' => $this->getUser()->getUsername() ] + $ret; |
|
469 | + $ret = ['username' => $this->getUser()->getUsername()]+$ret; |
|
470 | 470 | } |
471 | 471 | if ($includeProject) { |
472 | - $ret = [ 'project' => $this->getProject()->getDomain() ] + $ret; |
|
472 | + $ret = ['project' => $this->getProject()->getDomain()]+$ret; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | return $ret; |