Passed
Push — temp-accounts ( 4ef405...cfe971 )
by MusikAnimal
06:01 queued 01:25
created
src/Model/PageInfoApi.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
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         [$bytes, $chars, $words] = $this->countCharsAndWords($crawler);
181 181
 
182 182
         $refContent = [];
183
-        $refs->each(function ($ref) use (&$refContent): void {
183
+        $refs->each(function($ref) use (&$refContent): void {
184 184
             $refContent[] = $ref->text();
185 185
         });
186 186
         $uniqueRefs = count(array_unique($refContent));
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
             '[typeof~="mw:Extension/templatestyles"]',
216 216
             '[typeof~="mw:Extension/math"]',
217 217
             '[typeof~="mw:Extension/ref"]',
218
-        ]))->each(function (Crawler $subCrawler) {
218
+        ]))->each(function(Crawler $subCrawler) {
219 219
             foreach ($subCrawler as $subNode) {
220 220
                 $subNode->parentNode->removeChild($subNode);
221 221
             }
222 222
         });
223 223
 
224
-        $paragraphs->each(function ($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
224
+        $paragraphs->each(function($node) use (&$totalBytes, &$totalChars, &$totalWords): void {
225 225
             /** @var Crawler $node */
226 226
             $text = $node->text();
227 227
             $totalBytes += strlen($text);
@@ -306,24 +306,24 @@  discard block
 block discarded – undo
306 306
         if ($info) {
307 307
             $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
308 308
             $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
309
-            $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
309
+            $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
310 310
 
311 311
             $assessment = $page->getProject()
312 312
                 ->getPageAssessments()
313 313
                 ->getAssessment($page);
314 314
 
315 315
             $data = array_merge($data, [
316
-                'revisions' => (int) $info['num_edits'],
317
-                'editors' => (int) $info['num_editors'],
318
-                'anon_edits' => (int) $info['anon_edits'],
319
-                'minor_edits' => (int) $info['minor_edits'],
316
+                'revisions' => (int)$info['num_edits'],
317
+                'editors' => (int)$info['num_editors'],
318
+                'anon_edits' => (int)$info['anon_edits'],
319
+                'minor_edits' => (int)$info['minor_edits'],
320 320
                 'creator' => $info['creator'],
321
-                'creator_editcount' => null === $info['creator_editcount'] ? null : (int) $info['creator_editcount'],
321
+                'creator_editcount' => null === $info['creator_editcount'] ? null : (int)$info['creator_editcount'],
322 322
                 'created_at' => $creationDateTime,
323 323
                 'created_rev_id' => $info['created_rev_id'],
324 324
                 'modified_at' => $modifiedDateTime,
325 325
                 'secs_since_last_edit' => $secsSinceLastEdit,
326
-                'modified_rev_id' => (int) $info['modified_rev_id'],
326
+                'modified_rev_id' => (int)$info['modified_rev_id'],
327 327
                 'assessment' => $assessment,
328 328
             ]);
329 329
         }
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
         }
474 474
 
475 475
         // Sort by edit count.
476
-        uasort($this->bots, function ($a, $b) {
477
-            return $b['count'] - $a['count'];
476
+        uasort($this->bots, function($a, $b) {
477
+            return $b['count']-$a['count'];
478 478
         });
479 479
 
480 480
         return $this->bots;
Please login to merge, or discard this patch.
src/Model/User.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\Model;
6 6
 
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
             $firstAddrUnpacked = unpack('H*', $firstAddrBin);
132 132
             $firstAddrHex = reset($firstAddrUnpacked);
133 133
             $range[0] = inet_ntop($firstAddrBin);
134
-            $flexBits = 128 - $prefixLen;
134
+            $flexBits = 128-$prefixLen;
135 135
             $lastAddrHex = $firstAddrHex;
136 136
 
137 137
             $pos = 31;
138 138
             while ($flexBits > 0) {
139 139
                 $orig = substr($lastAddrHex, $pos, 1);
140 140
                 $origVal = hexdec($orig);
141
-                $newVal = $origVal | (pow(2, min(4, $flexBits)) - 1);
141
+                $newVal = $origVal | (pow(2, min(4, $flexBits))-1);
142 142
                 $new = dechex($newVal);
143 143
                 $lastAddrHex = substr_replace($lastAddrHex, $new, $pos, 1);
144 144
                 $flexBits -= 4;
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
             $range[1] = inet_ntop($lastAddrBin);
150 150
         } else {
151 151
             $cidr = explode('/', $this->username);
152
-            $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32 - (int)$cidr[1]));
153
-            $range[1] = long2ip(ip2long($range[0]) + pow(2, (32 - (int)$cidr[1])) - 1);
152
+            $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32-(int)$cidr[1]));
153
+            $range[1] = long2ip(ip2long($range[0])+pow(2, (32-(int)$cidr[1]))-1);
154 154
         }
155 155
 
156 156
         // Find the leftmost common characters between the two addresses.
@@ -351,17 +351,17 @@  discard block
 block discarded – undo
351 351
         foreach ($project->getTempAccountPatterns() as $pattern) {
352 352
             $varPos = strpos($pattern, '$1');
353 353
             if (false === $varPos) {
354
-                throw new UnexpectedValueException('Invalid temp account pattern: ' . $pattern);
354
+                throw new UnexpectedValueException('Invalid temp account pattern: '.$pattern);
355 355
             }
356 356
             $prefix = substr($pattern, 0, $varPos);
357
-            $suffix = substr($pattern, $varPos + 2);
357
+            $suffix = substr($pattern, $varPos+2);
358 358
             $match = true;
359 359
             if ('' !== $prefix) {
360 360
                 $match = str_starts_with($username, $prefix);
361 361
             }
362 362
             if ($match && '' !== $suffix) {
363 363
                 $match = str_ends_with($username, $suffix)
364
-                    && strlen($username) >= strlen($prefix) + strlen($suffix);
364
+                    && strlen($username) >= strlen($prefix)+strlen($suffix);
365 365
             }
366 366
             if ($match) {
367 367
                 return true;
Please login to merge, or discard this patch.
src/Controller/PageInfoController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
             return $this->getApiHtmlResponse($this->project, $this->page, $data);
291 291
         }
292 292
 
293
-        $this->addFlash('warning', 'In XTools 3.21, the last_edit_id property will be removed. ' .
293
+        $this->addFlash('warning', 'In XTools 3.21, the last_edit_id property will be removed. '.
294 294
             'Use the modified_rev_id property instead.');
295 295
         $data['last_edit_id'] = $data['modified_rev_id'];
296
-        $this->addFlash('warning', 'In XTools 3.21, the author and author_editcount properties ' .
296
+        $this->addFlash('warning', 'In XTools 3.21, the author and author_editcount properties '.
297 297
             'will be removed. Instead, use creator and creator_editcount, respectively.');
298 298
         $data['author'] = $data['creator'];
299 299
         $data['author_editcount'] = $data['creator_editcount'];
300
-        $this->addFlash('warning', 'In XTools 3.21, the ip_edits property will be removed. ' .
300
+        $this->addFlash('warning', 'In XTools 3.21, the ip_edits property will be removed. '.
301 301
             'Use the anon_edits property instead.');
302 302
         $data['ip_edits'] = $data['anon_edits'];
303 303
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $responseCode = Response::HTTP_OK;
373 373
         $this->recordApiUsage('page/prose');
374 374
         $this->setupPageInfo($pageInfoRepo, $autoEditsHelper);
375
-        $this->addFlash('info', 'The algorithm used by this API has recently changed. ' .
375
+        $this->addFlash('info', 'The algorithm used by this API has recently changed. '.
376 376
             'See https://www.mediawiki.org/wiki/XTools/Page_History#Prose for details.');
377 377
         $ret = $this->pageInfo->getProseStats();
378 378
         if (null === $ret) {
Please login to merge, or discard this patch.