@@ -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 |
@@ -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\Repository; |
6 | 6 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | if ($this->parameterBag->has("database_meta_table")) { |
167 | - $table = $this->parameterBag->get('database_meta_name') . '.' . |
|
167 | + $table = $this->parameterBag->get('database_meta_name').'.'. |
|
168 | 168 | $this->parameterBag->get('database_meta_table'); |
169 | 169 | } else { |
170 | 170 | $table = "meta_p.wiki"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | || $projMetadata['url'] == "https://$project" |
214 | 214 | || $projMetadata['url'] == "https://$project.org" |
215 | 215 | || $projMetadata['url'] == "https://www.$project") { |
216 | - $this->logger->debug(__METHOD__ . " Using cached data for $project"); |
|
216 | + $this->logger->debug(__METHOD__." Using cached data for $project"); |
|
217 | 217 | return $projMetadata; |
218 | 218 | } |
219 | 219 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | ]])->getBody()->getContents(), true); |
410 | 410 | |
411 | 411 | $extensions = $res['query']['extensions'] ?? []; |
412 | - return array_map(function ($extension) { |
|
412 | + return array_map(function($extension) { |
|
413 | 413 | return $extension['name']; |
414 | 414 | }, $extensions); |
415 | 415 | } |
@@ -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\Repository; |
6 | 6 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | // $tableExtension in order to generate the new table name |
210 | 210 | if ($this->isWMF && null !== $tableExtension) { |
211 | 211 | $mapped = true; |
212 | - $tableName .=('' === $tableExtension ? '' : '_'.$tableExtension); |
|
212 | + $tableName .= ('' === $tableExtension ? '' : '_'.$tableExtension); |
|
213 | 213 | } elseif ($this->parameterBag->has("app.table.$tableName")) { |
214 | 214 | // Use the table specified in the table mapping configuration, if present. |
215 | 215 | $mapped = true; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | // This is a safeguard in case table mapping isn't properly set up. |
222 | 222 | $isLoggingOrRevision = in_array($tableName, ['revision', 'logging', 'archive']); |
223 | 223 | if (!$mapped && $isLoggingOrRevision && $this->isWMF) { |
224 | - $tableName .="_userindex"; |
|
224 | + $tableName .= "_userindex"; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Figure out database name. |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $offset = date('YmdHis', $offset); |
341 | 341 | $datesConditions .= " AND $tableAlias{$field} <= '$offset'"; |
342 | 342 | } elseif (is_int($end)) { |
343 | - $end = date('Ymd', $end) . '235959'; |
|
343 | + $end = date('Ymd', $end).'235959'; |
|
344 | 344 | $datesConditions .= " AND $tableAlias{$field} <= '$end'"; |
345 | 345 | } |
346 | 346 |
@@ -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\Repository; |
6 | 6 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
303 | 303 | |
304 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
304 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
305 | 305 | FROM wikidatawiki_p.wb_items_per_site |
306 | 306 | WHERE ips_item_id = :wikidataId"; |
307 | 307 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | 'wikidataId' => $wikidataId, |
310 | 310 | ])->fetchAllAssociative(); |
311 | 311 | |
312 | - return $count ? (int) $result[0]['count'] : $result; |
|
312 | + return $count ? (int)$result[0]['count'] : $result; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | // Transform to associative array by 'type' |
349 | 349 | foreach ($res as $row) { |
350 | - $data[$row['type'] . '_count'] = (int)$row['value']; |
|
350 | + $data[$row['type'].'_count'] = (int)$row['value']; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return $data; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | $project = $page->getProject()->getDomain(); |
390 | 390 | |
391 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
391 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
392 | 392 | "$project/all-access/user/$title/daily/$start/$end"; |
393 | 393 | |
394 | 394 | $res = $this->guzzle->request('GET', $url); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $normalized = []; |
461 | 461 | if (isset($result['query']['normalized'])) { |
462 | 462 | array_map( |
463 | - function ($e) use (&$normalized): void { |
|
463 | + function($e) use (&$normalized): void { |
|
464 | 464 | $normalized[$e['to']] = $e['from']; |
465 | 465 | }, |
466 | 466 | $result['query']['normalized'] |
@@ -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\Helper; |
6 | 6 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | // Find the path, and complain if English doesn't exist. |
62 | - $path = $this->projectDir . '/i18n'; |
|
62 | + $path = $this->projectDir.'/i18n'; |
|
63 | 63 | if (!file_exists("$path/en.json")) { |
64 | 64 | throw new Exception("Language directory doesn't exist: $path"); |
65 | 65 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $messageFiles = glob($this->projectDir.'/i18n/*.json'); |
115 | 115 | |
116 | 116 | $languages = array_values(array_unique(array_map( |
117 | - function ($filename) { |
|
117 | + function($filename) { |
|
118 | 118 | return basename($filename, '.json'); |
119 | 119 | }, |
120 | 120 | $messageFiles |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->getIntuition()->getLangFallbacks($useLang) |
159 | 159 | ); |
160 | 160 | |
161 | - return array_filter($fallbacks, function ($lang) use ($i18nPath) { |
|
161 | + return array_filter($fallbacks, function($lang) use ($i18nPath) { |
|
162 | 162 | return is_file($i18nPath.$lang.'.json'); |
163 | 163 | }); |
164 | 164 | } |
@@ -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\Helper; |
6 | 6 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | return $this->cache->getItem($cacheKey)->get(); |
80 | 80 | } |
81 | 81 | |
82 | - $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title=' . |
|
83 | - 'MediaWiki:XTools-AutoEdits.json' . ($useSandbox ? '/sandbox' : ''); |
|
82 | + $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title='. |
|
83 | + 'MediaWiki:XTools-AutoEdits.json'.($useSandbox ? '/sandbox' : ''); |
|
84 | 84 | |
85 | 85 | if ($useSandbox && $this->session->get('logged_in_user')) { |
86 | 86 | // Request via OAuth to get around server-side caching. |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | // Once last walk through for some tidying up and validation. |
145 | 145 | $invalid = []; |
146 | - array_walk($this->tools[$projectDomain], function (&$data, $tool) use (&$invalid): void { |
|
146 | + array_walk($this->tools[$projectDomain], function(&$data, $tool) use (&$invalid): void { |
|
147 | 147 | // Populate the 'label' with the tool name, if a label doesn't already exist. |
148 | 148 | $data['label'] = $data['label'] ?? $tool; |
149 | 149 | |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | |
228 | 228 | $revertEntries = array_filter( |
229 | 229 | $this->getTools($project), |
230 | - function ($tool) { |
|
230 | + function($tool) { |
|
231 | 231 | return isset($tool['revert']) && isset($tool['regex']); |
232 | 232 | } |
233 | 233 | ); |
234 | 234 | |
235 | 235 | // If 'revert' is set to `true`, then use 'regex' as the regular expression, |
236 | 236 | // otherwise 'revert' is assumed to be the regex string. |
237 | - $this->revertTools[$projectDomain] = array_map(function ($revertTool) { |
|
237 | + $this->revertTools[$projectDomain] = array_map(function($revertTool) { |
|
238 | 238 | return [ |
239 | 239 | 'link' => $revertTool['link'], |
240 | 240 | 'regex' => true === $revertTool['revert'] ? $revertTool['regex'] : $revertTool['revert'], |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | if (file_exists(dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php')) { |
6 | 6 | require dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php'; |