Passed
Push — api-consistency ( ff12f0 )
by MusikAnimal
06:36
created
src/Model/EditCounter.php 1 patch
Spacing   +19 added lines, -19 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
         ];
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
     public function countSmallEdits(): int
1023 1023
     {
1024 1024
         $editSizeData = $this->getEditSizeData();
1025
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
1025
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
1026 1026
     }
1027 1027
 
1028 1028
     /**
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
     public function countLargeEdits(): int
1033 1033
     {
1034 1034
         $editSizeData = $this->getEditSizeData();
1035
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
1035
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
1036 1036
     }
1037 1037
 
1038 1038
     /**
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
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         [$bytes, $chars, $words] = $this->countCharsAndWords($crawler);
180 180
 
181 181
         $refContent = [];
182
-        $refs->each(function ($ref) use (&$refContent): void {
182
+        $refs->each(function($ref) use (&$refContent): void {
183 183
             $refContent[] = $ref->text();
184 184
         });
185 185
         $uniqueRefs = count(array_unique($refContent));
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
             '[typeof~="mw:Extension/templatestyles"]',
215 215
             '[typeof~="mw:Extension/math"]',
216 216
             '[typeof~="mw:Extension/ref"]',
217
-        ]))->each(function (Crawler $subCrawler) {
217
+        ]))->each(function(Crawler $subCrawler) {
218 218
             foreach ($subCrawler as $subNode) {
219 219
                 $subNode->parentNode->removeChild($subNode);
220 220
             }
221 221
         });
222 222
 
223
-        $paragraphs->each(function ($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
223
+        $paragraphs->each(function($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
224 224
             /** @var Crawler $node */
225 225
             $text = $node->text();
226 226
             $totalBytes += strlen($text);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         if ($info) {
306 306
             $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
307 307
             $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
308
-            $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
308
+            $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
309 309
 
310 310
             // Some wikis (such foundation.wikimedia.org) may be missing the creation date.
311 311
             $creationDateTime = false === $creationDateTime ? null : $creationDateTime;
@@ -315,17 +315,17 @@  discard block
 block discarded – undo
315 315
                 ->getAssessment($page);
316 316
 
317 317
             $data = array_merge($data, [
318
-                'revisions' => (int) $info['num_edits'],
319
-                'editors' => (int) $info['num_editors'],
320
-                'ip_edits' => (int) $info['ip_edits'],
321
-                'minor_edits' => (int) $info['minor_edits'],
318
+                'revisions' => (int)$info['num_edits'],
319
+                'editors' => (int)$info['num_editors'],
320
+                'ip_edits' => (int)$info['ip_edits'],
321
+                'minor_edits' => (int)$info['minor_edits'],
322 322
                 'author' => $info['author'],
323
-                'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'],
323
+                'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'],
324 324
                 'created_at' => $creationDateTime,
325 325
                 'created_rev_id' => $info['created_rev_id'],
326 326
                 'modified_at' => $modifiedDateTime,
327 327
                 'secs_since_last_edit' => $secsSinceLastEdit,
328
-                'last_edit_id' => (int) $info['modified_rev_id'],
328
+                'last_edit_id' => (int)$info['modified_rev_id'],
329 329
                 'assessment' => $assessment,
330 330
             ]);
331 331
         }
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
         }
476 476
 
477 477
         // Sort by edit count.
478
-        uasort($this->bots, function ($a, $b) {
479
-            return $b['count'] - $a['count'];
478
+        uasort($this->bots, function($a, $b) {
479
+            return $b['count']-$a['count'];
480 480
         });
481 481
 
482 482
         return $this->bots;
Please login to merge, or discard this patch.
src/Controller/AutomatedEditsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -328,7 +328,7 @@
 block discarded – undo
328 328
             'total_editcount' => $this->autoEdits->getEditCount(),
329 329
             'automated_editcount' => $this->autoEdits->getAutomatedCount(),
330 330
         ];
331
-        $ret['nonautomated_editcount'] = $ret['total_editcount'] - $ret['automated_editcount'];
331
+        $ret['nonautomated_editcount'] = $ret['total_editcount']-$ret['automated_editcount'];
332 332
 
333 333
         $ret['tools'] = $this->getBoolVal('tools');
334 334
         if ($ret['tools']) {
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
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             throw new XtoolsHttpException(
298 298
                 $this->i18n->msg('not-opted-in', [
299 299
                     $this->getOptedInPage()->getTitle(),
300
-                    $this->i18n->msg('not-opted-in-link') .
300
+                    $this->i18n->msg('not-opted-in-link').
301 301
                         ' <https://www.mediawiki.org/wiki/Special:MyLanguage/XTools/Edit_Counter#restricted_stats>',
302 302
                     $this->i18n->msg('not-opted-in-login'),
303 303
                 ]),
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
             }
582 582
 
583 583
             throw new XtoolsHttpException(
584
-                $this->i18n->msg('too-many-edits', [ $user->maxEdits() ]),
584
+                $this->i18n->msg('too-many-edits', [$user->maxEdits()]),
585 585
                 $this->generateUrl($this->tooHighEditCountRoute(), $this->params),
586 586
                 $originalParams,
587 587
                 $this->isApi,
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
         $params = $this->convertLegacyParams($params);
731 731
 
732 732
         // Remove blank values.
733
-        return array_filter($params, function ($param) {
733
+        return array_filter($params, function($param) {
734 734
             // 'namespace' or 'username' could be '0'.
735 735
             return null !== $param && '' !== $param;
736 736
         });
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
             // Show warnings that the date range was truncated.
789 789
             $this->addFlashMessage('warning', 'date-range-too-wide', [$this->maxDays()]);
790 790
 
791
-            $startTime = strtotime('-' . $this->maxDays() . ' days', $endTime);
791
+            $startTime = strtotime('-'.$this->maxDays().' days', $endTime);
792 792
         }
793 793
 
794 794
         return [$startTime, $endTime];
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
         }
967 967
 
968 968
         $elapsedTime = round(
969
-            microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'],
969
+            microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'],
970 970
             3
971 971
         );
972 972
         return array_merge($params, ['elapsed_time' => $elapsedTime]);
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
     public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array
1005 1005
     {
1006 1006
         // Add full_page_title (in addition to the existing page_title and namespace keys).
1007
-        $out[$key] = array_map(function ($rev) {
1007
+        $out[$key] = array_map(function($rev) {
1008 1008
             if ($rev instanceof Edit) {
1009 1009
                 $rev = $rev->getForJson();
1010 1010
             }
Please login to merge, or discard this patch.