@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -290,14 +290,14 @@ discard block |
||
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 |
||
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) { |