Passed
Push — bad-gateway-exception ( 5b308d...21df66 )
by MusikAnimal
02:59
created
src/Repository/PageRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Repository;
6 6
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
         $project = $page->getProject()->getDomain();
401 401
 
402
-        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' .
402
+        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'.
403 403
             "$project/all-access/user/$title/daily/$start/$end";
404 404
 
405 405
         try {
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
             ]);
410 410
             $pageviews = json_decode($res->getBody()->getContents(), true);
411 411
             return $pageviews;
412
-        } catch (ServerException|ConnectException $e) {
412
+        } catch (ServerException | ConnectException $e) {
413 413
             throw new BadGatewayException('api-error-wikimedia', $e);
414 414
         }
415 415
     }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     {
425 425
         if ($this->isWMF) {
426 426
             $domain = $page->getProject()->getDomain();
427
-            $url = "https://$domain/api/rest_v1/page/html/" . urlencode(str_replace(' ', '_', $page->getTitle()));
427
+            $url = "https://$domain/api/rest_v1/page/html/".urlencode(str_replace(' ', '_', $page->getTitle()));
428 428
             if (null !== $revId) {
429 429
                 $url .= "/$revId";
430 430
             }
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             $normalized = [];
493 493
             if (isset($result['query']['normalized'])) {
494 494
                 array_map(
495
-                    function ($e) use (&$normalized): void {
495
+                    function($e) use (&$normalized): void {
496 496
                         $normalized[$e['to']] = $e['from'];
497 497
                     },
498 498
                     $result['query']['normalized']
Please login to merge, or discard this patch.