@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the I18nHelper. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Helper; |
9 | 9 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | // Find the path, and complain if English doesn't exist. |
77 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
77 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
78 | 78 | if (!file_exists("$path/en.json")) { |
79 | 79 | throw new Exception("Language directory doesn't exist: $path"); |
80 | 80 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $messageFiles = glob($this->container->getParameter('kernel.root_dir').'/../i18n/*.json'); |
130 | 130 | |
131 | 131 | $languages = array_values(array_unique(array_map( |
132 | - function ($filename) { |
|
132 | + function($filename) { |
|
133 | 133 | return basename($filename, '.json'); |
134 | 134 | }, |
135 | 135 | $messageFiles |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $this->getIntuition()->getLangFallbacks($this->getLang()) |
172 | 172 | ); |
173 | 173 | |
174 | - return array_filter($fallbacks, function ($lang) use ($i18nPath) { |
|
174 | + return array_filter($fallbacks, function($lang) use ($i18nPath) { |
|
175 | 175 | return is_file($i18nPath.$lang.'.json'); |
176 | 176 | }); |
177 | 177 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the ArticleInfoRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $datesConditions = $this->getDateConditions($start, $end); |
35 | 35 | |
36 | 36 | $sql = "SELECT COUNT(DISTINCT(rev_id)) AS count, rev_user_text AS username, ug_group AS current |
37 | - FROM " . $project->getTableName('revision') . " |
|
37 | + FROM " . $project->getTableName('revision')." |
|
38 | 38 | LEFT JOIN $userGroupsTable ON rev_user = ug_user |
39 | 39 | LEFT JOIN $userFormerGroupsTable ON rev_user = ufg_user |
40 | 40 | WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot') $datesConditions |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp' |
60 | 60 | FROM $loggingTable |
61 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
61 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
62 | 62 | AND log_title = :title AND log_timestamp > 1 $datesConditions |
63 | 63 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
64 | 64 | $title = str_replace(' ', '_', $page->getTitle()); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $projectLang = $page->getProject()->getLang(); |
81 | 81 | |
82 | - $url = "https://api.wikiwho.net/$projectLang/api/v1.0.0-beta/rev_content/" . |
|
82 | + $url = "https://api.wikiwho.net/$projectLang/api/v1.0.0-beta/rev_content/". |
|
83 | 83 | "$title/?o_rev_id=false&editor=true&token_id=false&out=false&in=false"; |
84 | 84 | |
85 | 85 | $res = $client->request('GET', $url, ['http_errors' => false]); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the TopEditsRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments() && 0 === $namespace; |
59 | 59 | $paTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
60 | 60 | $paSelect = $hasPageAssessments |
61 | - ? ", ( |
|
61 | + ? ", ( |
|
62 | 62 | SELECT pa_class |
63 | 63 | FROM $paTable |
64 | 64 | WHERE pa_page_id = page_id |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments(); |
140 | 140 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
141 | 141 | $paSelect = $hasPageAssessments |
142 | - ? ", ( |
|
142 | + ? ", ( |
|
143 | 143 | SELECT pa_class |
144 | 144 | FROM $pageAssessmentsTable |
145 | 145 | WHERE pa_page_id = e.page_id |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the PageRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // supply as the OFFSET. |
153 | 153 | $limitClause = ''; |
154 | 154 | if (intval($limit) > 0 && isset($numRevisions)) { |
155 | - $offset = $numRevisions - $limit; |
|
155 | + $offset = $numRevisions-$limit; |
|
156 | 156 | $limitClause = "LIMIT $offset, $limit"; |
157 | 157 | } |
158 | 158 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $time2 = time(); |
294 | 294 | |
295 | 295 | // If it took over 5 seconds, cache the result for 20 minutes. |
296 | - if ($time2 - $time1 > 5) { |
|
296 | + if ($time2-$time1 > 5) { |
|
297 | 297 | $this->setCache($cacheKey, $result, 'PT20M'); |
298 | 298 | } |
299 | 299 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | |
382 | 382 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
383 | 383 | |
384 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
384 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
385 | 385 | FROM wikidatawiki_p.wb_items_per_site |
386 | 386 | WHERE ips_item_id = :wikidataId"; |
387 | 387 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | 'wikidataId' => $wikidataId, |
390 | 390 | ])->fetchAll(); |
391 | 391 | |
392 | - return $count ? (int) $result[0]['count'] : $result; |
|
392 | + return $count ? (int)$result[0]['count'] : $result; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | // Transform to associative array by 'type' |
429 | 429 | foreach ($res as $row) { |
430 | - $data[$row['type'] . '_count'] = (int)$row['value']; |
|
430 | + $data[$row['type'].'_count'] = (int)$row['value']; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | return $data; |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | |
470 | 470 | $project = $page->getProject()->getDomain(); |
471 | 471 | |
472 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
472 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
473 | 473 | "$project/all-access/user/$title/daily/$start/$end"; |
474 | 474 | |
475 | 475 | $res = $client->request('GET', $url); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | $normalized = []; |
542 | 542 | if (isset($result['query']['normalized'])) { |
543 | 543 | array_map( |
544 | - function ($e) use (&$normalized): void { |
|
544 | + function($e) use (&$normalized): void { |
|
545 | 545 | $normalized[$e['to']] = $e['from']; |
546 | 546 | }, |
547 | 547 | $result['query']['normalized'] |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the PageAssessmentsRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the AdminStatsRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the CategoryEditsRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the UserRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the Repository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace AppBundle\Repository; |
9 | 9 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | return null; |
93 | 93 | } |
94 | 94 | |
95 | - $requestTime = microtime(true) - $request->server->get('REQUEST_TIME_FLOAT'); |
|
95 | + $requestTime = microtime(true)-$request->server->get('REQUEST_TIME_FLOAT'); |
|
96 | 96 | |
97 | 97 | return [ |
98 | 98 | 'requestTime' => round($requestTime, 2), |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // $tableExtension in order to generate the new table name |
190 | 190 | if ($this->isLabs() && null !== $tableExtension) { |
191 | 191 | $mapped = true; |
192 | - $tableName .=('' === $tableExtension ? '' : '_'.$tableExtension); |
|
192 | + $tableName .= ('' === $tableExtension ? '' : '_'.$tableExtension); |
|
193 | 193 | } elseif ($this->container->hasParameter("app.table.$tableName")) { |
194 | 194 | // Use the table specified in the table mapping configuration, if present. |
195 | 195 | $mapped = true; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | // This is a safeguard in case table mapping isn't properly set up. |
202 | 202 | $isLoggingOrRevision = in_array($tableName, ['revision', 'logging', 'archive']); |
203 | 203 | if (!$mapped && $isLoggingOrRevision && $this->isLabs()) { |
204 | - $tableName .="_userindex"; |
|
204 | + $tableName .= "_userindex"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | // Figure out database name. |