@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace AppBundle\Controller; |
5 | 5 |
@@ -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 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $this->namespace, |
138 | 138 | $this->start, |
139 | 139 | $this->end, |
140 | - self::PAGE_SIZE + 1, |
|
140 | + self::PAGE_SIZE+1, |
|
141 | 141 | $this->offset |
142 | 142 | ); |
143 | 143 | $globalEdits = []; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace AppBundle\Twig; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace AppBundle\Repository; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace AppBundle\Repository; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace AppBundle\Model; |
5 | 5 |
@@ -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 AppBundle\Repository; |
9 | 9 | |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | ])->fetchAll(); |
120 | 120 | |
121 | 121 | $logCounts = array_combine( |
122 | - array_map(function ($e) { |
|
122 | + array_map(function($e) { |
|
123 | 123 | return $e['source']; |
124 | 124 | }, $results), |
125 | - array_map(function ($e) { |
|
125 | + array_map(function($e) { |
|
126 | 126 | return (int)$e['value']; |
127 | 127 | }, $results) |
128 | 128 | ); |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | $results = $this->executeProjectsQuery($sql, $bindings)->fetchAll(); |
215 | 215 | |
216 | 216 | $counts = array_combine( |
217 | - array_map(function ($e) { |
|
217 | + array_map(function($e) { |
|
218 | 218 | return $e['key']; |
219 | 219 | }, $results), |
220 | - array_map(function ($e) { |
|
220 | + array_map(function($e) { |
|
221 | 221 | return (int)$e['val']; |
222 | 222 | }, $results) |
223 | 223 | ); |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | 'actorId' => $user->getActorId($project), |
328 | 328 | ])->fetchAll(); |
329 | 329 | |
330 | - $namespaceTotals = array_combine(array_map(function ($e) { |
|
330 | + $namespaceTotals = array_combine(array_map(function($e) { |
|
331 | 331 | return $e['page_namespace']; |
332 | - }, $results), array_map(function ($e) { |
|
332 | + }, $results), array_map(function($e) { |
|
333 | 333 | return (int)$e['total']; |
334 | 334 | }, $results)); |
335 | 335 |
@@ -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 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
308 | 308 | |
309 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
309 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
310 | 310 | FROM wikidatawiki_p.wb_items_per_site |
311 | 311 | WHERE ips_item_id = :wikidataId"; |
312 | 312 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | 'wikidataId' => $wikidataId, |
315 | 315 | ])->fetchAll(); |
316 | 316 | |
317 | - return $count ? (int) $result[0]['count'] : $result; |
|
317 | + return $count ? (int)$result[0]['count'] : $result; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | // Transform to associative array by 'type' |
354 | 354 | foreach ($res as $row) { |
355 | - $data[$row['type'] . '_count'] = (int)$row['value']; |
|
355 | + $data[$row['type'].'_count'] = (int)$row['value']; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | return $data; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | $project = $page->getProject()->getDomain(); |
398 | 398 | |
399 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
399 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
400 | 400 | "$project/all-access/user/$title/daily/$start/$end"; |
401 | 401 | |
402 | 402 | $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'] |
@@ -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 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp' |
86 | 86 | FROM $loggingTable |
87 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
87 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
88 | 88 | AND log_title = :title AND log_timestamp > 1 $datesConditions |
89 | 89 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
90 | 90 | $title = str_replace(' ', '_', $page->getTitle()); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $time2 = time(); |
266 | 266 | |
267 | 267 | // If it took over 5 seconds, cache the result for 20 minutes. |
268 | - if ($time2 - $time1 > 5) { |
|
268 | + if ($time2-$time1 > 5) { |
|
269 | 269 | $this->setCache($cacheKey, $result, 'PT20M'); |
270 | 270 | } |
271 | 271 |