@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\Model; |
6 | 6 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $title = $info['title'] ?? $this->unnormalizedPageName; |
125 | 125 | $nsName = $this->getNamespaceName(); |
126 | 126 | return $nsName |
127 | - ? str_replace($nsName . ':', '', $title) |
|
127 | + ? str_replace($nsName.':', '', $title) |
|
128 | 128 | : $title; |
129 | 129 | } |
130 | 130 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | { |
323 | 323 | $content = $this->repository->getPagesWikitext( |
324 | 324 | $this->getProject(), |
325 | - [ $this->getTitle() ] |
|
325 | + [$this->getTitle()] |
|
326 | 326 | ); |
327 | 327 | |
328 | 328 | return $content[$this->getTitle()] ?? null; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | $wikidataInfo = $this->repository->getWikidataInfo($this); |
390 | 390 | |
391 | - $terms = array_map(function ($entry) { |
|
391 | + $terms = array_map(function($entry) { |
|
392 | 392 | return $entry['term']; |
393 | 393 | }, $wikidataInfo); |
394 | 394 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | 'prio' => 2, |
400 | 400 | 'name' => 'Wikidata', |
401 | 401 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
402 | - 'explanation' => "See: <a target='_blank' " . |
|
402 | + 'explanation' => "See: <a target='_blank' ". |
|
403 | 403 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
404 | 404 | ]; |
405 | 405 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | 'prio' => 3, |
410 | 410 | 'name' => 'Wikidata', |
411 | 411 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
412 | - 'explanation' => "See: <a target='_blank' " . |
|
412 | + 'explanation' => "See: <a target='_blank' ". |
|
413 | 413 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
414 | 414 | ]; |
415 | 415 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | return 0; |
488 | 488 | } |
489 | 489 | |
490 | - return array_sum(array_map(function ($item) { |
|
490 | + return array_sum(array_map(function($item) { |
|
491 | 491 | return (int)$item['views']; |
492 | 492 | }, $pageviews['items'])); |
493 | 493 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\Model; |
6 | 6 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $firstDateTime = $this->topEdits[0]->getTimestamp(); |
165 | 165 | $lastDateTime = end($this->topEdits)->getTimestamp(); |
166 | - $secs = $firstDateTime->getTimestamp() - $lastDateTime->getTimestamp(); |
|
166 | + $secs = $firstDateTime->getTimestamp()-$lastDateTime->getTimestamp(); |
|
167 | 167 | $days = $secs / (60 * 60 * 24); |
168 | 168 | return $days / count($this->topEdits); |
169 | 169 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\Model; |
6 | 6 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getTotalEditCount(): int |
156 | 156 | { |
157 | - return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count'] + $this->data['live_edit_count']; |
|
157 | + return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count']+$this->data['live_edit_count']; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Model; |
5 | 5 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\Twig; |
6 | 6 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | public function requestTime(): float |
118 | 118 | { |
119 | 119 | if (!isset($this->requestTime)) { |
120 | - $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
120 | + $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $this->requestTime; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | $sizeMessage = $this->numberFormat( |
547 | - pow(1024, $base - floor($base)), |
|
547 | + pow(1024, $base-floor($base)), |
|
548 | 548 | $precision |
549 | 549 | ); |
550 | 550 | |
@@ -701,15 +701,15 @@ discard block |
||
701 | 701 | |
702 | 702 | if ($seconds >= 86400) { |
703 | 703 | // Over a day |
704 | - $val = (int) floor($seconds / 86400); |
|
704 | + $val = (int)floor($seconds / 86400); |
|
705 | 705 | $key = 'days'; |
706 | 706 | } elseif ($seconds >= 3600) { |
707 | 707 | // Over an hour, less than a day |
708 | - $val = (int) floor($seconds / 3600); |
|
708 | + $val = (int)floor($seconds / 3600); |
|
709 | 709 | $key = 'hours'; |
710 | 710 | } elseif ($seconds >= 60) { |
711 | 711 | // Over a minute, less than an hour |
712 | - $val = (int) floor($seconds / 60); |
|
712 | + $val = (int)floor($seconds / 60); |
|
713 | 713 | $key = 'minutes'; |
714 | 714 | } |
715 | 715 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\EventSubscriber; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\Model; |
6 | 6 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->repository = $repository; |
49 | 49 | $this->project = $project; |
50 | 50 | $this->user = $user; |
51 | - $this->categories = array_map(function ($category) { |
|
51 | + $this->categories = array_map(function($category) { |
|
52 | 52 | return str_replace(' ', '_', $category); |
53 | 53 | }, $categories); |
54 | 54 | $this->start = $start; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getCategoriesNormalized(): array |
82 | 82 | { |
83 | - return array_map(function ($category) { |
|
83 | + return array_map(function($category) { |
|
84 | 84 | return str_replace('_', ' ', $category); |
85 | 85 | }, $this->categories); |
86 | 86 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | throw new XtoolsHttpException( |
297 | 297 | $this->i18n->msg('not-opted-in', [ |
298 | 298 | $this->getOptedInPage()->getTitle(), |
299 | - $this->i18n->msg('not-opted-in-link') . |
|
299 | + $this->i18n->msg('not-opted-in-link'). |
|
300 | 300 | ' <https://www.mediawiki.org/wiki/Special:MyLanguage/XTools/Edit_Counter#restricted_stats>', |
301 | 301 | $this->i18n->msg('not-opted-in-login'), |
302 | 302 | ]), |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | } |
572 | 572 | |
573 | 573 | throw new XtoolsHttpException( |
574 | - $this->i18n->msg('too-many-edits', [ $user->maxEdits() ]), |
|
574 | + $this->i18n->msg('too-many-edits', [$user->maxEdits()]), |
|
575 | 575 | $this->generateUrl($this->tooHighEditCountRoute(), $this->params), |
576 | 576 | $originalParams, |
577 | 577 | $this->isApi |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | $params = $this->convertLegacyParams($params); |
714 | 714 | |
715 | 715 | // Remove blank values. |
716 | - return array_filter($params, function ($param) { |
|
716 | + return array_filter($params, function($param) { |
|
717 | 717 | // 'namespace' or 'username' could be '0'. |
718 | 718 | return null !== $param && '' !== $param; |
719 | 719 | }); |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | // Show warnings that the date range was truncated. |
772 | 772 | $this->addFlashMessage('warning', 'date-range-too-wide', [$this->maxDays()]); |
773 | 773 | |
774 | - $startTime = strtotime('-' . $this->maxDays() . ' days', $endTime); |
|
774 | + $startTime = strtotime('-'.$this->maxDays().' days', $endTime); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | return [$startTime, $endTime]; |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | } |
912 | 912 | |
913 | 913 | $elapsedTime = round( |
914 | - microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT'), |
|
914 | + microtime(true)-$this->request->server->get('REQUEST_TIME_FLOAT'), |
|
915 | 915 | 3 |
916 | 916 | ); |
917 | 917 | |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array |
953 | 953 | { |
954 | 954 | // Add full_page_title (in addition to the existing page_title and page_namespace keys). |
955 | - $out[$key] = array_map(function ($rev) { |
|
955 | + $out[$key] = array_map(function($rev) { |
|
956 | 956 | return array_merge([ |
957 | 957 | 'full_page_title' => $this->getPageFromNsAndTitle( |
958 | 958 | (int)$rev['page_namespace'], |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | string $centralAuthProject |
67 | 67 | ): RedirectResponse { |
68 | 68 | try { |
69 | - [ $next, $token ] = $this->getOauthClient($request, $projectRepo, $centralAuthProject)->initiate(); |
|
69 | + [$next, $token] = $this->getOauthClient($request, $projectRepo, $centralAuthProject)->initiate(); |
|
70 | 70 | } catch (Exception $oauthException) { |
71 | 71 | throw $oauthException; |
72 | 72 | // @TODO Make this work. |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | . '?title=Special:OAuth'; |
156 | 156 | $conf = new ClientConfig($endpoint); |
157 | 157 | $consumerKey = $this->getParameter('oauth_key'); |
158 | - $consumerSecret = $this->getParameter('oauth_secret'); |
|
158 | + $consumerSecret = $this->getParameter('oauth_secret'); |
|
159 | 159 | $conf->setConsumer(new Consumer($consumerKey, $consumerSecret)); |
160 | 160 | $this->oauthClient = new Client($conf); |
161 | 161 |