@@ -295,7 +295,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'], |
@@ -335,7 +335,7 @@ |
||
335 | 335 | 'total_editcount' => $this->autoEdits->getEditCount(), |
336 | 336 | 'automated_editcount' => $this->autoEdits->getAutomatedCount(), |
337 | 337 | ]; |
338 | - $ret['nonautomated_editcount'] = $ret['total_editcount'] - $ret['automated_editcount']; |
|
338 | + $ret['nonautomated_editcount'] = $ret['total_editcount']-$ret['automated_editcount']; |
|
339 | 339 | |
340 | 340 | if ($this->getBoolVal('tools')) { |
341 | 341 | $tools = $this->autoEdits->getToolCounts(); |
@@ -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 | |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | ])->fetchAllAssociative(); |
162 | 162 | |
163 | 163 | $logCounts = array_combine( |
164 | - array_map(function ($e) { |
|
164 | + array_map(function($e) { |
|
165 | 165 | return $e['source']; |
166 | 166 | }, $results), |
167 | - array_map(function ($e) { |
|
167 | + array_map(function($e) { |
|
168 | 168 | return (int)$e['value']; |
169 | 169 | }, $results) |
170 | 170 | ); |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | $counts = array_combine( |
247 | - array_map(function ($e) { |
|
247 | + array_map(function($e) { |
|
248 | 248 | return $e['key']; |
249 | 249 | }, $results), |
250 | - array_map(function ($e) { |
|
250 | + array_map(function($e) { |
|
251 | 251 | return (int)$e['val']; |
252 | 252 | }, $results) |
253 | 253 | ); |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | |
430 | 430 | $results = $this->executeProjectsQuery($project, $sql, $params)->fetchAll(); |
431 | 431 | |
432 | - $namespaceTotals = array_combine(array_map(function ($e) { |
|
432 | + $namespaceTotals = array_combine(array_map(function($e) { |
|
433 | 433 | return $e['namespace']; |
434 | - }, $results), array_map(function ($e) { |
|
434 | + }, $results), array_map(function($e) { |
|
435 | 435 | return (int)$e['total']; |
436 | 436 | }, $results)); |
437 | 437 |
@@ -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 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp' |
175 | 175 | FROM $loggingTable |
176 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
176 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
177 | 177 | AND log_title = :title AND log_timestamp > 1 $datesConditions |
178 | 178 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
179 | 179 | $title = str_replace(' ', '_', $page->getTitle()); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $time2 = time(); |
359 | 359 | |
360 | 360 | // If it took over 5 seconds, cache the result for 20 minutes. |
361 | - if ($time2 - $time1 > 5) { |
|
361 | + if ($time2-$time1 > 5) { |
|
362 | 362 | $this->setCache($cacheKey, $result, 'PT20M'); |
363 | 363 | } |
364 | 364 | |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | // Sort the array by count |
432 | - uasort($results, function ($a, $b) { |
|
433 | - return $b['count'] - $a['count']; |
|
432 | + uasort($results, function($a, $b) { |
|
433 | + return $b['count']-$a['count']; |
|
434 | 434 | }); |
435 | 435 | |
436 | 436 | return $this->setCache($cacheKey, $results); |
@@ -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 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | [$bytes, $chars, $words] = $this->countCharsAndWords($crawler); |
179 | 179 | |
180 | 180 | $refContent = []; |
181 | - $refs->each(function ($ref) use (&$refContent): void { |
|
181 | + $refs->each(function($ref) use (&$refContent): void { |
|
182 | 182 | $refContent[] = $ref->text(); |
183 | 183 | }); |
184 | 184 | $uniqueRefs = count(array_unique($refContent)); |
@@ -213,13 +213,13 @@ discard block |
||
213 | 213 | '[typeof~="mw:Extension/templatestyles"]', |
214 | 214 | '[typeof~="mw:Extension/math"]', |
215 | 215 | '[typeof~="mw:Extension/ref"]', |
216 | - ]))->each(function (Crawler $subCrawler) { |
|
216 | + ]))->each(function(Crawler $subCrawler) { |
|
217 | 217 | foreach ($subCrawler as $subNode) { |
218 | 218 | $subNode->parentNode->removeChild($subNode); |
219 | 219 | } |
220 | 220 | }); |
221 | 221 | |
222 | - $paragraphs->each(function ($node) use (&$totalBytes, &$totalChars, &$totalWords): void { |
|
222 | + $paragraphs->each(function($node) use (&$totalBytes, &$totalChars, &$totalWords): void { |
|
223 | 223 | /** @var Crawler $node */ |
224 | 224 | $text = $node->text(); |
225 | 225 | $totalBytes += strlen($text); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $data = [ |
282 | 282 | 'project' => $project->getDomain(), |
283 | 283 | 'page' => $page->getTitle(), |
284 | - 'watchers' => (int) $page->getWatchers(), |
|
284 | + 'watchers' => (int)$page->getWatchers(), |
|
285 | 285 | 'pageviews' => $page->getLatestPageviews(), |
286 | 286 | 'pageviews_offset' => self::PAGEVIEWS_OFFSET, |
287 | 287 | ]; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | if ($info) { |
305 | 305 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
306 | 306 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
307 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
307 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
308 | 308 | |
309 | 309 | // Some wikis (such foundation.wikimedia.org) may be missing the creation date. |
310 | 310 | $creationDateTime = false === $creationDateTime |
@@ -316,17 +316,17 @@ discard block |
||
316 | 316 | ->getAssessment($page); |
317 | 317 | |
318 | 318 | $data = array_merge($data, [ |
319 | - 'revisions' => (int) $info['num_edits'], |
|
320 | - 'editors' => (int) $info['num_editors'], |
|
321 | - 'ip_edits' => (int) $info['ip_edits'], |
|
322 | - 'minor_edits' => (int) $info['minor_edits'], |
|
319 | + 'revisions' => (int)$info['num_edits'], |
|
320 | + 'editors' => (int)$info['num_editors'], |
|
321 | + 'ip_edits' => (int)$info['ip_edits'], |
|
322 | + 'minor_edits' => (int)$info['minor_edits'], |
|
323 | 323 | 'author' => $info['author'], |
324 | - 'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'], |
|
324 | + 'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'], |
|
325 | 325 | 'created_at' => $creationDateTime, |
326 | 326 | 'created_rev_id' => $info['created_rev_id'], |
327 | 327 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
328 | 328 | 'secs_since_last_edit' => $secsSinceLastEdit, |
329 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
329 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
330 | 330 | 'assessment' => $assessment, |
331 | 331 | ]); |
332 | 332 | } |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | } |
477 | 477 | |
478 | 478 | // Sort by edit count. |
479 | - uasort($this->bots, function ($a, $b) { |
|
480 | - return $b['count'] - $a['count']; |
|
479 | + uasort($this->bots, function($a, $b) { |
|
480 | + return $b['count']-$a['count']; |
|
481 | 481 | }); |
482 | 482 | |
483 | 483 | return $this->bots; |
@@ -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 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $firstDateTime = $this->topEdits[0]->getTimestamp(); |
165 | 165 | $lastDateTime = end($this->topEdits)->getTimestamp(); |
166 | - $secs = $firstDateTime->getTimestamp() - $lastDateTime->getTimestamp(); |
|
166 | + $secs = $firstDateTime->getTimestamp()-$lastDateTime->getTimestamp(); |
|
167 | 167 | $days = $secs / (60 * 60 * 24); |
168 | 168 | return $days / count($this->topEdits); |
169 | 169 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | if ($format) { |
266 | 266 | return $this->formatTopEditsPage($revs); |
267 | 267 | } else { |
268 | - return array_map(function ($rev) { |
|
268 | + return array_map(function($rev) { |
|
269 | 269 | $rev['minor'] = (bool)$rev['minor']; |
270 | 270 | $rev['reverted'] = (bool)$rev['reverted']; |
271 | 271 | return $rev; |
@@ -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 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $hasPageAssessments = $this->isWMF && $project->hasPageAssessments($namespace); |
115 | 115 | $paTable = $project->getTableName('page_assessments'); |
116 | 116 | $paSelect = $hasPageAssessments |
117 | - ? ", ( |
|
117 | + ? ", ( |
|
118 | 118 | SELECT pa_class |
119 | 119 | FROM $paTable |
120 | 120 | WHERE pa_page_id = page_id |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $hasPageAssessments = $this->isWMF && $project->hasPageAssessments(); |
229 | 229 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
230 | 230 | $paSelect = $hasPageAssessments |
231 | - ? ", ( |
|
231 | + ? ", ( |
|
232 | 232 | SELECT pa_class |
233 | 233 | FROM $pageAssessmentsTable |
234 | 234 | WHERE pa_page_id = e.page_id |
@@ -146,7 +146,7 @@ |
||
146 | 146 | $actionsRequested = is_array($actionsQuery) ? $actionsQuery : array_filter(explode('|', $actionsQuery)); |
147 | 147 | |
148 | 148 | // Filter out any invalid action names. |
149 | - $actions = array_filter($actionsRequested, function ($action) use ($group) { |
|
149 | + $actions = array_filter($actionsRequested, function($action) use ($group) { |
|
150 | 150 | return in_array($action, $this->getActionNames($group)); |
151 | 151 | }); |
152 | 152 |
@@ -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 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | $numResults = count($this->getResults()[$this->getNamespace()]); |
137 | - $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults - 1]['timestamp']); |
|
137 | + $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults-1]['timestamp']); |
|
138 | 138 | return $timestamp->format('Y-m-d\TH:i:s'); |
139 | 139 | } |
140 | 140 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $summaryColumns[] = 'average-page-size'; |
340 | 340 | |
341 | 341 | // Re-sort based on $order |
342 | - return array_values(array_filter($order, static function ($column) use ($summaryColumns) { |
|
342 | + return array_values(array_filter($order, static function($column) use ($summaryColumns) { |
|
343 | 343 | return in_array($column, $summaryColumns); |
344 | 344 | })); |
345 | 345 | } |