Passed
Push — swagger-docs ( 6837d7 )
by MusikAnimal
11:33
created
src/Model/Page.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\Model;
6 6
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $title = $info['title'] ?? $this->unnormalizedPageName;
125 125
         $nsName = $this->getNamespaceName();
126 126
         return $nsName
127
-            ? str_replace($nsName . ':', '', $title)
127
+            ? str_replace($nsName.':', '', $title)
128 128
             : $title;
129 129
     }
130 130
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
     {
323 323
         $content = $this->repository->getPagesWikitext(
324 324
             $this->getProject(),
325
-            [ $this->getTitle() ]
325
+            [$this->getTitle()]
326 326
         );
327 327
 
328 328
         return $content[$this->getTitle()] ?? null;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
         $wikidataInfo = $this->repository->getWikidataInfo($this);
390 390
 
391
-        $terms = array_map(function ($entry) {
391
+        $terms = array_map(function($entry) {
392 392
             return $entry['term'];
393 393
         }, $wikidataInfo);
394 394
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
                 'prio' => 2,
400 400
                 'name' => 'Wikidata',
401 401
                 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n
402
-                'explanation' => "See: <a target='_blank' " .
402
+                'explanation' => "See: <a target='_blank' ".
403 403
                     "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>",
404 404
             ];
405 405
         }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                 'prio' => 3,
410 410
                 'name' => 'Wikidata',
411 411
                 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n
412
-                'explanation' => "See: <a target='_blank' " .
412
+                'explanation' => "See: <a target='_blank' ".
413 413
                     "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>",
414 414
             ];
415 415
         }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
             return null;
492 492
         }
493 493
 
494
-        return array_sum(array_map(function ($item) {
494
+        return array_sum(array_map(function($item) {
495 495
             return (int)$item['views'];
496 496
         }, $pageviews['items']));
497 497
     }
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
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         [$bytes, $chars, $words] = $this->countCharsAndWords($crawler);
172 172
 
173 173
         $refContent = [];
174
-        $refs->each(function ($ref) use (&$refContent): void {
174
+        $refs->each(function($ref) use (&$refContent): void {
175 175
             $refContent[] = $ref->text();
176 176
         });
177 177
         $uniqueRefs = count(array_unique($refContent));
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
             '[typeof~="mw:Extension/templatestyles"]',
207 207
             '[typeof~="mw:Extension/math"]',
208 208
             '[typeof~="mw:Extension/ref"]',
209
-        ]))->each(function (Crawler $subCrawler) {
209
+        ]))->each(function(Crawler $subCrawler) {
210 210
             foreach ($subCrawler as $subNode) {
211 211
                 $subNode->parentNode->removeChild($subNode);
212 212
             }
213 213
         });
214 214
 
215
-        $paragraphs->each(function ($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
215
+        $paragraphs->each(function($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
216 216
             /** @var Crawler $node */
217 217
             $text = $node->text();
218 218
             $totalBytes += strlen($text);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $data = [
275 275
             'project' => $project->getDomain(),
276 276
             'page' => $page->getTitle(),
277
-            'watchers' => (int) $page->getWatchers(),
277
+            'watchers' => (int)$page->getWatchers(),
278 278
             'pageviews' => $page->getLatestPageviews(),
279 279
             'pageviews_offset' => self::PAGEVIEWS_OFFSET,
280 280
         ];
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
         if ($info) {
298 298
             $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
299 299
             $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
300
-            $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
300
+            $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
301 301
 
302 302
             // Some wikis (such foundation.wikimedia.org) may be missing the creation date.
303 303
             $creationDateTime = false === $creationDateTime
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
                 ->getAssessment($page);
310 310
 
311 311
             $data = array_merge($data, [
312
-                'revisions' => (int) $info['num_edits'],
313
-                'editors' => (int) $info['num_editors'],
314
-                'minor_edits' => (int) $info['minor_edits'],
312
+                'revisions' => (int)$info['num_edits'],
313
+                'editors' => (int)$info['num_editors'],
314
+                'minor_edits' => (int)$info['minor_edits'],
315 315
                 'author' => $info['author'],
316
-                'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'],
316
+                'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'],
317 317
                 'created_at' => $creationDateTime,
318 318
                 'created_rev_id' => $info['created_rev_id'],
319 319
                 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'),
320 320
                 'secs_since_last_edit' => $secsSinceLastEdit,
321
-                'last_edit_id' => (int) $info['modified_rev_id'],
321
+                'last_edit_id' => (int)$info['modified_rev_id'],
322 322
                 'assessment' => $assessment,
323 323
             ]);
324 324
         }
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
         }
469 469
 
470 470
         // Sort by edit count.
471
-        uasort($this->bots, function ($a, $b) {
472
-            return $b['count'] - $a['count'];
471
+        uasort($this->bots, function($a, $b) {
472
+            return $b['count']-$a['count'];
473 473
         });
474 474
 
475 475
         return $this->bots;
Please login to merge, or discard this patch.
src/Controller/ArticleInfoController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -267,7 +267,7 @@
 block discarded – undo
267 267
         $responseCode = Response::HTTP_OK;
268 268
         $this->recordApiUsage('page/prose');
269 269
         $this->setupArticleInfo($articleInfoRepo, $autoEditsHelper);
270
-        $this->addFlash('info', 'The algorithm used by this API has recently changed. ' .
270
+        $this->addFlash('info', 'The algorithm used by this API has recently changed. '.
271 271
             'See https://www.mediawiki.org/wiki/XTools/Page_History#Prose for details.');
272 272
         $ret = $this->articleInfo->getProseStats();
273 273
         if (null === $ret) {
Please login to merge, or discard this patch.
src/Repository/AuthorshipRepository.php 1 patch
Spacing   +2 added lines, -2 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
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         try {
49 49
             $res = $this->guzzle->request('GET', $url, $opts);
50
-        } catch (ServerException|ConnectException $e) {
50
+        } catch (ServerException | ConnectException $e) {
51 51
             throw new BadGatewayException('api-error-wikimedia', ['WikiWho'], $e);
52 52
         }
53 53
 
Please login to merge, or discard this patch.
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.
src/Model/EditCounter.php 1 patch
Spacing   +22 added lines, -22 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
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         // Filter out unblocks unless requested.
162 162
         if ($blocksOnly) {
163
-            $blocks = array_filter($blocks, function ($block) {
163
+            $blocks = array_filter($blocks, function($block) {
164 164
                 return 'block' === $block['log_action'];
165 165
             });
166 166
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     public function countAllRevisions(): int
196 196
     {
197
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
197
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
198 198
     }
199 199
 
200 200
     /**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public function countAllPagesEdited(): int
235 235
     {
236
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
236
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
237 237
     }
238 238
 
239 239
     /**
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function countPagesCreated(): int
245 245
     {
246
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
246
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
247 247
     }
248 248
 
249 249
     /**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             } elseif ('unblock' === $block['log_action']) {
373 373
                 // The last block was lifted. So the duration will be the time from when the
374 374
                 // last block was set to the time of the unblock.
375
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
375
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
376 376
                 if ($timeSinceLastBlock > $this->longestBlockSeconds) {
377 377
                     $this->longestBlockSeconds = $timeSinceLastBlock;
378 378
 
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
                 // The last block was modified. So we will adjust $lastBlock to include
384 384
                 // the difference of the duration of the new reblock, and time since the last block.
385 385
                 // $lastBlock is left unchanged if its duration was indefinite.
386
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
387
-                $lastBlock[1] = $timeSinceLastBlock + $duration;
386
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
387
+                $lastBlock[1] = $timeSinceLastBlock+$duration;
388 388
             }
389 389
         }
390 390
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         }
395 395
 
396 396
         // Test if the last block is still active, and if so use the expiry as the duration.
397
-        $lastBlockExpiry = $lastBlock[0] + $lastBlock[1];
397
+        $lastBlockExpiry = $lastBlock[0]+$lastBlock[1];
398 398
         if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) {
399 399
             $this->longestBlockSeconds = $lastBlock[1];
400 400
         // Otherwise, test if the duration of the last block is now the longest overall.
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
         // If invalid, $duration is left as null.
439 439
         if (strtotime($durationStr)) {
440 440
             $expiry = strtotime($durationStr, $timestamp);
441
-            $duration = $expiry - $timestamp;
441
+            $duration = $expiry-$timestamp;
442 442
         }
443 443
 
444 444
         return [$timestamp, $duration];
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
         $import = $logCounts['import-import'] ?? 0;
526 526
         $interwiki = $logCounts['import-interwiki'] ?? 0;
527 527
         $upload = $logCounts['import-upload'] ?? 0;
528
-        return $import + $interwiki + $upload;
528
+        return $import+$interwiki+$upload;
529 529
     }
530 530
 
531 531
     /**
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         $logCounts = $this->getLogCounts();
548 548
         $new = $logCounts['contentmodel-new'] ?? 0;
549 549
         $modified = $logCounts['contentmodel-change'] ?? 0;
550
-        return $new + $modified;
550
+        return $new+$modified;
551 551
     }
552 552
 
553 553
     /**
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
     public function approvals(): int
677 677
     {
678 678
         $logCounts = $this->getLogCounts();
679
-        return (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0) +
680
-            (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0) +
681
-            (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
679
+        return (!empty($logCounts['review-approve']) ? $logCounts['review-approve'] : 0)+
680
+            (!empty($logCounts['review-approve2']) ? $logCounts['review-approve2'] : 0)+
681
+            (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
682 682
             (!empty($logCounts['review-approve2-i']) ? $logCounts['review-approve2-i'] : 0);
683 683
     }
684 684
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
         $logCounts = $this->getLogCounts();
702 702
         $create2 = $logCounts['newusers-create2'] ?: 0;
703 703
         $byemail = $logCounts['newusers-byemail'] ?: 0;
704
-        return $create2 + $byemail;
704
+        return $create2+$byemail;
705 705
     }
706 706
 
707 707
     /**
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 
804 804
         $totals = $this->repository->getMonthCounts($this->project, $this->user);
805 805
         $out = [
806
-            'yearLabels' => [],  // labels for years
806
+            'yearLabels' => [], // labels for years
807 807
             'monthLabels' => [], // labels for months
808 808
             'totals' => [], // actual totals, grouped by namespace, year and then month
809 809
         ];
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
                 $out['totals'][$ns][$total['year']] = [];
898 898
             }
899 899
 
900
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
900
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
901 901
         }
902 902
 
903 903
         return [$out, $firstEdit];
@@ -914,9 +914,9 @@  discard block
 block discarded – undo
914 914
     private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange): array
915 915
     {
916 916
         foreach ($dateRange as $monthObj) {
917
-            $year = (int) $monthObj->format('Y');
917
+            $year = (int)$monthObj->format('Y');
918 918
             $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy');
919
-            $month = (int) $monthObj->format('n');
919
+            $month = (int)$monthObj->format('n');
920 920
             $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM');
921 921
 
922 922
             // Fill in labels
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
     public function countSmallEdits(): int
1061 1061
     {
1062 1062
         $editSizeData = $this->getEditSizeData();
1063
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
1063
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
1064 1064
     }
1065 1065
 
1066 1066
     /**
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
     public function countLargeEdits(): int
1071 1071
     {
1072 1072
         $editSizeData = $this->getEditSizeData();
1073
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
1073
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
1074 1074
     }
1075 1075
 
1076 1076
     /**
Please login to merge, or discard this patch.
src/Repository/Repository.php 1 patch
Spacing   +5 added lines, -5 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
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                     'format' => 'json',
197 197
                 ], $params),
198 198
             ])->getBody()->getContents(), true);
199
-        } catch (ServerException|ConnectException $e) {
199
+        } catch (ServerException | ConnectException $e) {
200 200
             throw new BadGatewayException('api-error-wikimedia', ['Wikimedia'], $e);
201 201
         }
202 202
     }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         // $tableExtension in order to generate the new table name
219 219
         if ($this->isWMF && null !== $tableExtension) {
220 220
             $mapped = true;
221
-            $tableName .=('' === $tableExtension ? '' : '_'.$tableExtension);
221
+            $tableName .= ('' === $tableExtension ? '' : '_'.$tableExtension);
222 222
         } elseif ($this->parameterBag->has("app.table.$tableName")) {
223 223
             // Use the table specified in the table mapping configuration, if present.
224 224
             $mapped = true;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         // This is a safeguard in case table mapping isn't properly set up.
231 231
         $isLoggingOrRevision = in_array($tableName, ['revision', 'logging', 'archive']);
232 232
         if (!$mapped && $isLoggingOrRevision && $this->isWMF) {
233
-            $tableName .="_userindex";
233
+            $tableName .= "_userindex";
234 234
         }
235 235
 
236 236
         // Figure out database name.
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             $offset = date('YmdHis', $offset);
350 350
             $datesConditions .= " AND $tableAlias{$field} <= '$offset'";
351 351
         } elseif (is_int($end)) {
352
-            $end = date('Ymd', $end) . '235959';
352
+            $end = date('Ymd', $end).'235959';
353 353
             $datesConditions .= " AND $tableAlias{$field} <= '$end'";
354 354
         }
355 355
 
Please login to merge, or discard this patch.
src/Model/Pages.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         }
128 128
 
129 129
         $numResults = count($this->getResults()[$this->getNamespace()]);
130
-        $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults - 1]['rev_timestamp']);
130
+        $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults-1]['rev_timestamp']);
131 131
         return $timestamp->format('Y-m-d\TH:i:s');
132 132
     }
133 133
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             $counts[$ns] = [
248 248
                 'count' => $count,
249 249
                 'total_length' => $totalLength,
250
-                'avg_length' => round($count > 0 ?$totalLength / $count : 0, 1),
250
+                'avg_length' => round($count > 0 ? $totalLength / $count : 0, 1),
251 251
             ];
252 252
             if ('live' !== $this->deleted) {
253 253
                 $counts[$ns]['deleted'] = (int)$row['deleted'];
Please login to merge, or discard this patch.
src/Controller/XtoolsController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             throw new XtoolsHttpException(
296 296
                 $this->i18n->msg('not-opted-in', [
297 297
                     $this->getOptedInPage()->getTitle(),
298
-                    $this->i18n->msg('not-opted-in-link') .
298
+                    $this->i18n->msg('not-opted-in-link').
299 299
                         ' <https://www.mediawiki.org/wiki/Special:MyLanguage/XTools/Edit_Counter#restricted_stats>',
300 300
                     $this->i18n->msg('not-opted-in-login'),
301 301
                 ]),
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
             }
571 571
 
572 572
             throw new XtoolsHttpException(
573
-                $this->i18n->msg('too-many-edits', [ $user->maxEdits() ]),
573
+                $this->i18n->msg('too-many-edits', [$user->maxEdits()]),
574 574
                 $this->generateUrl($this->tooHighEditCountRoute(), $this->params),
575 575
                 $originalParams,
576 576
                 $this->isApi,
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         $params = $this->convertLegacyParams($params);
715 715
 
716 716
         // Remove blank values.
717
-        return array_filter($params, function ($param) {
717
+        return array_filter($params, function($param) {
718 718
             // 'namespace' or 'username' could be '0'.
719 719
             return null !== $param && '' !== $param;
720 720
         });
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             // Show warnings that the date range was truncated.
773 773
             $this->addFlashMessage('warning', 'date-range-too-wide', [$this->maxDays()]);
774 774
 
775
-            $startTime = strtotime('-' . $this->maxDays() . ' days', $endTime);
775
+            $startTime = strtotime('-'.$this->maxDays().' days', $endTime);
776 776
         }
777 777
 
778 778
         return [$startTime, $endTime];
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
         }
945 945
 
946 946
         $elapsedTime = round(
947
-            microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'],
947
+            microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'],
948 948
             3
949 949
         );
950 950
         return array_merge($params, ['elapsed_time' => $elapsedTime]);
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
     public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array
975 975
     {
976 976
         // Add full_page_title (in addition to the existing page_title and namespace keys).
977
-        $out[$key] = array_map(function ($rev) {
977
+        $out[$key] = array_map(function($rev) {
978 978
             return array_merge([
979 979
                 'full_page_title' => $this->getPageFromNsAndTitle(
980 980
                     (int)$rev['namespace'],
Please login to merge, or discard this patch.