Passed
Push — main ( ebcad9...69ff57 )
by MusikAnimal
04:13
created
src/Repository/PageRepository.php 1 patch
Spacing   +7 added lines, -7 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
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
         $wikidataId = ltrim($page->getWikidataId(), 'Q');
303 303
 
304
-        $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . "
304
+        $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')."
305 305
                 FROM wikidatawiki_p.wb_items_per_site
306 306
                 WHERE ips_item_id = :wikidataId";
307 307
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             'wikidataId' => $wikidataId,
310 310
         ])->fetchAllAssociative();
311 311
 
312
-        return $count ? (int) $result[0]['count'] : $result;
312
+        return $count ? (int)$result[0]['count'] : $result;
313 313
     }
314 314
 
315 315
     /**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
         // Transform to associative array by 'type'
349 349
         foreach ($res as $row) {
350
-            $data[$row['type'] . '_count'] = (int)$row['value'];
350
+            $data[$row['type'].'_count'] = (int)$row['value'];
351 351
         }
352 352
 
353 353
         return $data;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
         $project = $page->getProject()->getDomain();
390 390
 
391
-        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' .
391
+        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'.
392 392
             "$project/all-access/user/$title/daily/$start/$end";
393 393
 
394 394
         $res = $this->guzzle->request('GET', $url);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     {
406 406
         if ($this->isWMF) {
407 407
             $domain = $page->getProject()->getDomain();
408
-            $url = "https://$domain/api/rest_v1/page/html/" . $page->getTitle();
408
+            $url = "https://$domain/api/rest_v1/page/html/".$page->getTitle();
409 409
             if (null !== $revId) {
410 410
                 $url .= "/$revId";
411 411
             }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             $normalized = [];
470 470
             if (isset($result['query']['normalized'])) {
471 471
                 array_map(
472
-                    function ($e) use (&$normalized): void {
472
+                    function($e) use (&$normalized): void {
473 473
                         $normalized[$e['to']] = $e['from'];
474 474
                     },
475 475
                     $result['query']['normalized']
Please login to merge, or discard this patch.
src/Model/ArticleInfoApi.php 1 patch
Spacing   +13 added lines, -13 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\Model;
6 6
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         [$bytes, $chars, $words] = $this->countCharsAndWords($crawler);
170 170
 
171 171
         $refContent = [];
172
-        $refs->each(function ($ref) use (&$refContent): void {
172
+        $refs->each(function($ref) use (&$refContent): void {
173 173
             $refContent[] = $ref->text();
174 174
         });
175 175
         $uniqueRefs = count(array_unique($refContent));
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
             '[typeof~="mw:Extension/templatestyles"]',
205 205
             '[typeof~="mw:Extension/math"]',
206 206
             '[typeof~="mw:Extension/ref"]',
207
-        ]))->each(function (Crawler $subCrawler) {
207
+        ]))->each(function(Crawler $subCrawler) {
208 208
             foreach ($subCrawler as $subNode) {
209 209
                 $subNode->parentNode->removeChild($subNode);
210 210
             }
211 211
         });
212 212
 
213
-        $paragraphs->each(function ($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
213
+        $paragraphs->each(function($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
214 214
             /** @var Crawler $node */
215 215
             $text = $node->text();
216 216
             $totalBytes += strlen($text);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $data = [
276 276
             'project' => $project->getDomain(),
277 277
             'page' => $page->getTitle(),
278
-            'watchers' => (int) $page->getWatchers(),
278
+            'watchers' => (int)$page->getWatchers(),
279 279
             'pageviews' => $page->getLastPageviews($pageviewsOffset),
280 280
             'pageviews_offset' => $pageviewsOffset,
281 281
         ];
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         if ($info) {
299 299
             $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
300 300
             $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
301
-            $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
301
+            $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
302 302
 
303 303
             // Some wikis (such foundation.wikimedia.org) may be missing the creation date.
304 304
             $creationDateTime = false === $creationDateTime
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
                 ->getAssessment($page);
311 311
 
312 312
             $data = array_merge($data, [
313
-                'revisions' => (int) $info['num_edits'],
314
-                'editors' => (int) $info['num_editors'],
315
-                'minor_edits' => (int) $info['minor_edits'],
313
+                'revisions' => (int)$info['num_edits'],
314
+                'editors' => (int)$info['num_editors'],
315
+                'minor_edits' => (int)$info['minor_edits'],
316 316
                 'author' => $info['author'],
317
-                'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'],
317
+                'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'],
318 318
                 'created_at' => $creationDateTime,
319 319
                 'created_rev_id' => $info['created_rev_id'],
320 320
                 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'),
321 321
                 'secs_since_last_edit' => $secsSinceLastEdit,
322
-                'last_edit_id' => (int) $info['modified_rev_id'],
322
+                'last_edit_id' => (int)$info['modified_rev_id'],
323 323
                 'assessment' => $assessment,
324 324
             ]);
325 325
         }
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
         }
470 470
 
471 471
         // Sort by edit count.
472
-        uasort($this->bots, function ($a, $b) {
473
-            return $b['count'] - $a['count'];
472
+        uasort($this->bots, function($a, $b) {
473
+            return $b['count']-$a['count'];
474 474
         });
475 475
 
476 476
         return $this->bots;
Please login to merge, or discard this patch.