@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Repository; |
5 | 5 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $slice = $this->getDbList()[$dbName]; |
175 | 175 | // actor_revision table only includes users who have made at least one edit. |
176 | 176 | $actorTable = $this->getTableName($dbName, 'actor', 'revision'); |
177 | - $queriesBySlice[$slice][] = "SELECT '$dbName' AS `dbName`, actor_id " . |
|
177 | + $queriesBySlice[$slice][] = "SELECT '$dbName' AS `dbName`, actor_id ". |
|
178 | 178 | "FROM $actorTable WHERE $whereClause"; |
179 | 179 | } |
180 | 180 | |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | // Re-assemble into UNIONed queries, executing as many per slice as possible. |
310 | 310 | $revisions = []; |
311 | 311 | foreach ($queriesBySlice as $slice => $queries) { |
312 | - $sql = "SELECT * FROM ((\n" . join("\n) UNION (\n", $queries) . ")) a ORDER BY timestamp DESC LIMIT $limit"; |
|
312 | + $sql = "SELECT * FROM ((\n".join("\n) UNION (\n", $queries).")) a ORDER BY timestamp DESC LIMIT $limit"; |
|
313 | 313 | $revisions = array_merge($revisions, $this->executeProjectsQuery($slice, $sql)->fetchAllAssociative()); |
314 | 314 | } |
315 | 315 | |
316 | 316 | // If there are more than $limit results, re-sort by timestamp. |
317 | 317 | if (count($revisions) > $limit) { |
318 | - usort($revisions, function ($a, $b) { |
|
318 | + usort($revisions, function($a, $b) { |
|
319 | 319 | if ($a['unix_timestamp'] === $b['unix_timestamp']) { |
320 | 320 | return 0; |
321 | 321 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the EditCounterRepository class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Repository; |
9 | 9 | |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | ])->fetchAllAssociative(); |
141 | 141 | |
142 | 142 | $logCounts = array_combine( |
143 | - array_map(function ($e) { |
|
143 | + array_map(function($e) { |
|
144 | 144 | return $e['source']; |
145 | 145 | }, $results), |
146 | - array_map(function ($e) { |
|
146 | + array_map(function($e) { |
|
147 | 147 | return (int)$e['value']; |
148 | 148 | }, $results) |
149 | 149 | ); |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | $counts = array_combine( |
226 | - array_map(function ($e) { |
|
226 | + array_map(function($e) { |
|
227 | 227 | return $e['key']; |
228 | 228 | }, $results), |
229 | - array_map(function ($e) { |
|
229 | + array_map(function($e) { |
|
230 | 230 | return (int)$e['val']; |
231 | 231 | }, $results) |
232 | 232 | ); |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | |
409 | 409 | $results = $this->executeProjectsQuery($project, $sql, $params)->fetchAll(); |
410 | 410 | |
411 | - $namespaceTotals = array_combine(array_map(function ($e) { |
|
411 | + $namespaceTotals = array_combine(array_map(function($e) { |
|
412 | 412 | return $e['page_namespace']; |
413 | - }, $results), array_map(function ($e) { |
|
413 | + }, $results), array_map(function($e) { |
|
414 | 414 | return (int)$e['total']; |
415 | 415 | }, $results)); |
416 | 416 |
@@ -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 App\Repository; |
9 | 9 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
307 | 307 | |
308 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
308 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
309 | 309 | FROM wikidatawiki_p.wb_items_per_site |
310 | 310 | WHERE ips_item_id = :wikidataId"; |
311 | 311 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | 'wikidataId' => $wikidataId, |
314 | 314 | ])->fetchAllAssociative(); |
315 | 315 | |
316 | - return $count ? (int) $result[0]['count'] : $result; |
|
316 | + return $count ? (int)$result[0]['count'] : $result; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | |
352 | 352 | // Transform to associative array by 'type' |
353 | 353 | foreach ($res as $row) { |
354 | - $data[$row['type'] . '_count'] = (int)$row['value']; |
|
354 | + $data[$row['type'].'_count'] = (int)$row['value']; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | return $data; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | $project = $page->getProject()->getDomain(); |
397 | 397 | |
398 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
398 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
399 | 399 | "$project/all-access/user/$title/daily/$start/$end"; |
400 | 400 | |
401 | 401 | $res = $client->request('GET', $url); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $normalized = []; |
472 | 472 | if (isset($result['query']['normalized'])) { |
473 | 473 | array_map( |
474 | - function ($e) use (&$normalized): void { |
|
474 | + function($e) use (&$normalized): void { |
|
475 | 475 | $normalized[$e['to']] = $e['from']; |
476 | 476 | }, |
477 | 477 | $result['query']['normalized'] |