@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->repository = $repository; |
49 | 49 | $this->project = $project; |
50 | 50 | $this->user = $user; |
51 | - $this->categories = array_map(function ($category) { |
|
51 | + $this->categories = array_map(function($category) { |
|
52 | 52 | return str_replace(' ', '_', $category); |
53 | 53 | }, $categories); |
54 | 54 | $this->start = $start; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getCategoriesNormalized(): array |
82 | 82 | { |
83 | - return array_map(function ($category) { |
|
83 | + return array_map(function($category) { |
|
84 | 84 | return str_replace('_', ' ', $category); |
85 | 85 | }, $this->categories); |
86 | 86 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | throw new XtoolsHttpException( |
268 | 268 | $this->i18n->msg('not-opted-in', [ |
269 | 269 | $this->getOptedInPage()->getTitle(), |
270 | - $this->i18n->msg('not-opted-in-link') . |
|
270 | + $this->i18n->msg('not-opted-in-link'). |
|
271 | 271 | ' <https://www.mediawiki.org/wiki/Special:MyLanguage/XTools/Edit_Counter#restricted_stats>', |
272 | 272 | $this->i18n->msg('not-opted-in-login'), |
273 | 273 | ]), |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | throw new XtoolsHttpException( |
547 | - $this->i18n->msg('too-many-edits', [ $user->maxEdits() ]), |
|
547 | + $this->i18n->msg('too-many-edits', [$user->maxEdits()]), |
|
548 | 548 | $this->generateUrl($this->tooHighEditCountRoute(), $this->params), |
549 | 549 | $originalParams, |
550 | 550 | $this->isApi |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | $params = $this->convertLegacyParams($params); |
707 | 707 | |
708 | 708 | // Remove blank values. |
709 | - return array_filter($params, function ($param) { |
|
709 | + return array_filter($params, function($param) { |
|
710 | 710 | // 'namespace' or 'username' could be '0'. |
711 | 711 | return null !== $param && '' !== $param; |
712 | 712 | }); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | // Show warnings that the date range was truncated. |
765 | 765 | $this->addFlashMessage('warning', 'date-range-too-wide', [$this->maxDays()]); |
766 | 766 | |
767 | - $startTime = strtotime('-' . $this->maxDays() . ' days', $endTime); |
|
767 | + $startTime = strtotime('-'.$this->maxDays().' days', $endTime); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | return [$startTime, $endTime]; |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | } |
908 | 908 | |
909 | 909 | $elapsedTime = round( |
910 | - microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT'), |
|
910 | + microtime(true)-$this->request->server->get('REQUEST_TIME_FLOAT'), |
|
911 | 911 | 3 |
912 | 912 | ); |
913 | 913 | |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array |
949 | 949 | { |
950 | 950 | // Add full_page_title (in addition to the existing page_title and page_namespace keys). |
951 | - $out[$key] = array_map(function ($rev) { |
|
951 | + $out[$key] = array_map(function($rev) { |
|
952 | 952 | return array_merge([ |
953 | 953 | 'full_page_title' => $this->getPageFromNsAndTitle( |
954 | 954 | (int)$rev['page_namespace'], |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | $conn = $this->container->get('doctrine') |
985 | 985 | ->getManager('default') |
986 | 986 | ->getConnection(); |
987 | - $date = date('Y-m-d'); |
|
987 | + $date = date('Y-m-d'); |
|
988 | 988 | |
989 | 989 | // Increment count in timeline |
990 | 990 | try { |
@@ -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 | |
170 | 170 | $refs = $crawler->filter('#mw-content-text .reference'); |
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)); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $totalChars = 0; |
198 | 198 | $totalWords = 0; |
199 | 199 | $paragraphs = $crawler->filter($selector); |
200 | - $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void { |
|
200 | + $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void { |
|
201 | 201 | /** @var Crawler $node */ |
202 | 202 | $text = preg_replace('/\[\d+]/', '', trim($node->text(null, true))); |
203 | 203 | $totalChars += strlen($text); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $data = [ |
262 | 262 | 'project' => $project->getDomain(), |
263 | 263 | 'page' => $page->getTitle(), |
264 | - 'watchers' => (int) $page->getWatchers(), |
|
264 | + 'watchers' => (int)$page->getWatchers(), |
|
265 | 265 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
266 | 266 | 'pageviews_offset' => $pageviewsOffset, |
267 | 267 | ]; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ($info) { |
285 | 285 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
286 | 286 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
287 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
287 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
288 | 288 | |
289 | 289 | // Some wikis (such foundation.wikimedia.org) may be missing the creation date. |
290 | 290 | $creationDateTime = false === $creationDateTime |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | ->getAssessment($page); |
297 | 297 | |
298 | 298 | $data = array_merge($data, [ |
299 | - 'revisions' => (int) $info['num_edits'], |
|
300 | - 'editors' => (int) $info['num_editors'], |
|
301 | - 'minor_edits' => (int) $info['minor_edits'], |
|
299 | + 'revisions' => (int)$info['num_edits'], |
|
300 | + 'editors' => (int)$info['num_editors'], |
|
301 | + 'minor_edits' => (int)$info['minor_edits'], |
|
302 | 302 | 'author' => $info['author'], |
303 | - 'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'], |
|
303 | + 'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'], |
|
304 | 304 | 'created_at' => $creationDateTime, |
305 | 305 | 'created_rev_id' => $info['created_rev_id'], |
306 | 306 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
307 | 307 | 'secs_since_last_edit' => $secsSinceLastEdit, |
308 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
308 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
309 | 309 | 'assessment' => $assessment, |
310 | 310 | ]); |
311 | 311 | } |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | } |
456 | 456 | |
457 | 457 | // Sort by edit count. |
458 | - uasort($this->bots, function ($a, $b) { |
|
459 | - return $b['count'] - $a['count']; |
|
458 | + uasort($this->bots, function($a, $b) { |
|
459 | + return $b['count']-$a['count']; |
|
460 | 460 | }); |
461 | 461 | |
462 | 462 | 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\Helper; |
6 | 6 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | // Find the path, and complain if English doesn't exist. |
61 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
61 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
62 | 62 | if (!file_exists("$path/en.json")) { |
63 | 63 | throw new Exception("Language directory doesn't exist: $path"); |
64 | 64 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $messageFiles = glob($this->container->getParameter('kernel.root_dir').'/../i18n/*.json'); |
114 | 114 | |
115 | 115 | $languages = array_values(array_unique(array_map( |
116 | - function ($filename) { |
|
116 | + function($filename) { |
|
117 | 117 | return basename($filename, '.json'); |
118 | 118 | }, |
119 | 119 | $messageFiles |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $this->getIntuition()->getLangFallbacks($useLang) |
158 | 158 | ); |
159 | 159 | |
160 | - return array_filter($fallbacks, function ($lang) use ($i18nPath) { |
|
160 | + return array_filter($fallbacks, function($lang) use ($i18nPath) { |
|
161 | 161 | return is_file($i18nPath.$lang.'.json'); |
162 | 162 | }); |
163 | 163 | } |