Passed
Push — bad-gateway ( 773331...8a0e57 )
by MusikAnimal
03:07
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
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
         $wikidataId = ltrim($page->getWikidataId(), 'Q');
310 310
 
311
-        $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . "
311
+        $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')."
312 312
                 FROM wikidatawiki_p.wb_items_per_site
313 313
                 WHERE ips_item_id = :wikidataId";
314 314
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             'wikidataId' => $wikidataId,
317 317
         ])->fetchAllAssociative();
318 318
 
319
-        return $count ? (int) $result[0]['count'] : $result;
319
+        return $count ? (int)$result[0]['count'] : $result;
320 320
     }
321 321
 
322 322
     /**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 
355 355
         // Transform to associative array by 'type'
356 356
         foreach ($res as $row) {
357
-            $data[$row['type'] . '_count'] = (int)$row['value'];
357
+            $data[$row['type'].'_count'] = (int)$row['value'];
358 358
         }
359 359
 
360 360
         return $data;
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 
406 406
         $project = $page->getProject()->getDomain();
407 407
 
408
-        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' .
408
+        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'.
409 409
             "$project/all-access/user/$title/daily/$start/$end";
410 410
 
411 411
         try {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
             ]);
416 416
             $pageviews = json_decode($res->getBody()->getContents(), true);
417 417
             return $pageviews;
418
-        } catch (ServerException|ConnectException $e) {
418
+        } catch (ServerException | ConnectException $e) {
419 419
             throw new BadGatewayException('api-error-wikimedia', ['Pageviews'], $e);
420 420
         }
421 421
     }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     {
432 432
         if ($this->isWMF) {
433 433
             $domain = $page->getProject()->getDomain();
434
-            $url = "https://$domain/api/rest_v1/page/html/" . urlencode(str_replace(' ', '_', $page->getTitle()));
434
+            $url = "https://$domain/api/rest_v1/page/html/".urlencode(str_replace(' ', '_', $page->getTitle()));
435 435
             if (null !== $revId) {
436 436
                 $url .= "/$revId";
437 437
             }
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
             $normalized = [];
506 506
             if (isset($result['query']['normalized'])) {
507 507
                 array_map(
508
-                    function ($e) use (&$normalized): void {
508
+                    function($e) use (&$normalized): void {
509 509
                         $normalized[$e['to']] = $e['from'];
510 510
                     },
511 511
                     $result['query']['normalized']
Please login to merge, or discard this patch.