@@ -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 | private function addFullPageTitlesAndContinue(string $type, 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[$type] = array_map(function ($rev) { |
|
| 908 | + $out[$type] = 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 |
@@ -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 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $this->project = ProjectRepository::getProject('meta.wikimedia', $this->container); |
| 191 | 191 | |
| 192 | 192 | $results = $globalContribs->globalEdits(); |
| 193 | - $results = array_map(function (Edit $edit) { |
|
| 193 | + $results = array_map(function(Edit $edit) { |
|
| 194 | 194 | return $edit->getForJson(true); |
| 195 | 195 | }, array_values($results)); |
| 196 | 196 | |
@@ -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 | |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | if ($sorted) { |
| 102 | 102 | // Sort. |
| 103 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
| 104 | - return $b['total'] - $a['total']; |
|
| 103 | + uasort($this->globalEditCounts, function($a, $b) { |
|
| 104 | + return $b['total']-$a['total']; |
|
| 105 | 105 | }); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $this->namespace, |
| 139 | 139 | $this->start, |
| 140 | 140 | $this->end, |
| 141 | - $this->limit + 1, |
|
| 141 | + $this->limit+1, |
|
| 142 | 142 | $this->offset |
| 143 | 143 | ); |
| 144 | 144 | |
@@ -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; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
| 321 | 321 | |
| 322 | 322 | if ($isSection && isset($page)) { |
| 323 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 323 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 324 | 324 | '$1', |
| 325 | 325 | $page->getTitle($useUnnormalizedPageTitle), |
| 326 | 326 | $project->getArticlePath() |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | // Must have underscores for the link to properly go to the section. |
| 331 | 331 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
| 332 | 332 | |
| 333 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
| 334 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
| 333 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
| 334 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
| 335 | 335 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
| 336 | 336 | } |
| 337 | 337 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | ); |
| 346 | 346 | |
| 347 | 347 | // Use normalized page title (underscored, capitalized). |
| 348 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
| 348 | + $pageUrl = $project->getUrl(false).str_replace( |
|
| 349 | 349 | '$1', |
| 350 | 350 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
| 351 | 351 | $project->getArticlePath() |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | public function getDiffUrl(): string |
| 384 | 384 | { |
| 385 | 385 | $project = $this->getProject(); |
| 386 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
| 387 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 386 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
| 387 | + return rtrim($project->getUrl(), '/').$path; |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | /** |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | public function getPermaUrl(): string |
| 395 | 395 | { |
| 396 | 396 | $project = $this->getProject(); |
| 397 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
| 398 | - return rtrim($project->getUrl(), '/') . $path; |
|
| 397 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
| 398 | + return rtrim($project->getUrl(), '/').$path; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /** |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | 'reverted' => $this->reverted, |
| 471 | 471 | ]; |
| 472 | 472 | if ($includeUsername) { |
| 473 | - $ret = [ 'username' => $this->getUser()->getUsername() ] + $ret; |
|
| 473 | + $ret = ['username' => $this->getUser()->getUsername()]+$ret; |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | return $ret; |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | private function addFullPageTitlesAndContinue(array $data): array |
| 480 | 480 | { |
| 481 | 481 | // Add full_page_title (in addition to the existing page_title and page_namespace keys). |
| 482 | - $data = array_map(function ($rev) { |
|
| 482 | + $data = array_map(function($rev) { |
|
| 483 | 483 | $nsName = $this->project->getNamespaces()[$rev['page_namespace']]; |
| 484 | 484 | $rev['full_page_title'] = $nsName.':'.$rev['page_title']; |
| 485 | 485 | return $rev; |