@@ -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\Helper; |
6 | 6 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | // Find the path, and complain if English doesn't exist. |
62 | - $path = $this->projectDir . '/i18n'; |
|
62 | + $path = $this->projectDir.'/i18n'; |
|
63 | 63 | if (!file_exists("$path/en.json")) { |
64 | 64 | throw new Exception("Language directory doesn't exist: $path"); |
65 | 65 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $messageFiles = glob($this->projectDir.'/i18n/*.json'); |
115 | 115 | |
116 | 116 | $languages = array_values(array_unique(array_map( |
117 | - function ($filename) { |
|
117 | + function($filename) { |
|
118 | 118 | return basename($filename, '.json'); |
119 | 119 | }, |
120 | 120 | $messageFiles |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->getIntuition()->getLangFallbacks($useLang) |
159 | 159 | ); |
160 | 160 | |
161 | - return array_filter($fallbacks, function ($lang) use ($i18nPath) { |
|
161 | + return array_filter($fallbacks, function($lang) use ($i18nPath) { |
|
162 | 162 | return is_file($i18nPath.$lang.'.json'); |
163 | 163 | }); |
164 | 164 | } |
@@ -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\Helper; |
6 | 6 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | return $this->cache->getItem($cacheKey)->get(); |
80 | 80 | } |
81 | 81 | |
82 | - $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title=' . |
|
83 | - 'MediaWiki:XTools-AutoEdits.json' . ($useSandbox ? '/sandbox' : ''); |
|
82 | + $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title='. |
|
83 | + 'MediaWiki:XTools-AutoEdits.json'.($useSandbox ? '/sandbox' : ''); |
|
84 | 84 | |
85 | 85 | if ($useSandbox && $this->session->get('logged_in_user')) { |
86 | 86 | // Request via OAuth to get around server-side caching. |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | // Once last walk through for some tidying up and validation. |
145 | 145 | $invalid = []; |
146 | - array_walk($this->tools[$projectDomain], function (&$data, $tool) use (&$invalid): void { |
|
146 | + array_walk($this->tools[$projectDomain], function(&$data, $tool) use (&$invalid): void { |
|
147 | 147 | // Populate the 'label' with the tool name, if a label doesn't already exist. |
148 | 148 | $data['label'] = $data['label'] ?? $tool; |
149 | 149 | |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | |
228 | 228 | $revertEntries = array_filter( |
229 | 229 | $this->getTools($project), |
230 | - function ($tool) { |
|
230 | + function($tool) { |
|
231 | 231 | return isset($tool['revert']) && isset($tool['regex']); |
232 | 232 | } |
233 | 233 | ); |
234 | 234 | |
235 | 235 | // If 'revert' is set to `true`, then use 'regex' as the regular expression, |
236 | 236 | // otherwise 'revert' is assumed to be the regex string. |
237 | - $this->revertTools[$projectDomain] = array_map(function ($revertTool) { |
|
237 | + $this->revertTools[$projectDomain] = array_map(function($revertTool) { |
|
238 | 238 | return [ |
239 | 239 | 'link' => $revertTool['link'], |
240 | 240 | 'regex' => true === $revertTool['revert'] ? $revertTool['regex'] : $revertTool['revert'], |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | if (file_exists(dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php')) { |
6 | 6 | require dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php'; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace DoctrineMigrations; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace DoctrineMigrations; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace DoctrineMigrations; |
6 | 6 |
@@ -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 | |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | $firstAddrUnpacked = unpack('H*', $firstAddrBin); |
127 | 127 | $firstAddrHex = reset($firstAddrUnpacked); |
128 | 128 | $range[0] = inet_ntop($firstAddrBin); |
129 | - $flexBits = 128 - $prefixLen; |
|
129 | + $flexBits = 128-$prefixLen; |
|
130 | 130 | $lastAddrHex = $firstAddrHex; |
131 | 131 | |
132 | 132 | $pos = 31; |
133 | 133 | while ($flexBits > 0) { |
134 | 134 | $orig = substr($lastAddrHex, $pos, 1); |
135 | 135 | $origVal = hexdec($orig); |
136 | - $newVal = $origVal | (pow(2, min(4, $flexBits)) - 1); |
|
136 | + $newVal = $origVal | (pow(2, min(4, $flexBits))-1); |
|
137 | 137 | $new = dechex($newVal); |
138 | 138 | $lastAddrHex = substr_replace($lastAddrHex, $new, $pos, 1); |
139 | 139 | $flexBits -= 4; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $range[1] = inet_ntop($lastAddrBin); |
145 | 145 | } else { |
146 | 146 | $cidr = explode('/', $this->username); |
147 | - $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32 - (int)$cidr[1])); |
|
148 | - $range[1] = long2ip(ip2long($range[0]) + pow(2, (32 - (int)$cidr[1])) - 1); |
|
147 | + $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32-(int)$cidr[1])); |
|
148 | + $range[1] = long2ip(ip2long($range[0])+pow(2, (32-(int)$cidr[1]))-1); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Find the leftmost common characters between the two addresses. |
@@ -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\Repository; |
6 | 6 | |
@@ -301,7 +301,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'] |
@@ -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 | |
@@ -169,7 +169,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |