@@ -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 | } |
@@ -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 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | SUM(IF(type = 'arc', 1, 0)) AS `deleted`, |
62 | 62 | SUM($summation) AS `redirects`, |
63 | 63 | SUM(rev_length) AS `total_length` |
64 | - FROM (" . |
|
64 | + FROM (". |
|
65 | 65 | $this->getPagesCreatedInnerSql($project, $conditions, $deleted, $start, $end, false, true)." |
66 | 66 | ) a ". |
67 | - $wasRedirect . |
|
67 | + $wasRedirect. |
|
68 | 68 | "GROUP BY `namespace`"; |
69 | 69 | |
70 | 70 | $result = $this->executeQuery($sql, $project, $user, $namespace) |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $sql = "SELECT * FROM (". |
131 | 131 | $this->getPagesCreatedInnerSql($project, $conditions, $deleted, $start, $end, $offset)." |
132 | 132 | ) a ". |
133 | - $wasRedirect . |
|
133 | + $wasRedirect. |
|
134 | 134 | "ORDER BY `timestamp` DESC |
135 | 135 | ".(!empty($limit) ? "LIMIT $limit" : ''); |
136 | 136 |
@@ -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 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function getUrl(bool $withTrailingSlash = true): string |
157 | 157 | { |
158 | - return rtrim($this->getBasicInfo()['url'], '/') . ($withTrailingSlash ? '/' : ''); |
|
158 | + return rtrim($this->getBasicInfo()['url'], '/').($withTrailingSlash ? '/' : ''); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if ($page instanceof Page) { |
172 | 172 | $page = $page->getTitle($useUnnormalizedPageTitle); |
173 | 173 | } |
174 | - return str_replace('$1', $page, $this->getUrl(false) . $this->getArticlePath()); |
|
174 | + return str_replace('$1', $page, $this->getUrl(false).$this->getArticlePath()); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | public function getScript(): string |
208 | 208 | { |
209 | 209 | $metadata = $this->getMetadata(); |
210 | - return $metadata['general']['script'] ?? $this->getScriptPath() . '/index.php'; |
|
210 | + return $metadata['general']['script'] ?? $this->getScriptPath().'/index.php'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function getApiUrl(): string |
218 | 218 | { |
219 | - return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath(); |
|
219 | + return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath(); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function userOptInPage(User $user): string |
293 | 293 | { |
294 | - return 'User:' . $user->getUsername() . '/EditCounterOptIn.js'; |
|
294 | + return 'User:'.$user->getUsername().'/EditCounterOptIn.js'; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | // 4. Lastly, see if they've opted in globally on the default project or Meta. |
328 | - $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js'; |
|
328 | + $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js'; |
|
329 | 329 | $globalProject = $this->getRepository()->getGlobalProject(); |
330 | 330 | $globalExists = $globalProject->getRepository() |
331 | 331 | ->pageHasContent($globalProject, $userNsId, $globalPageName); |
@@ -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 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | User $user, |
113 | 113 | array $revs |
114 | 114 | ): array { |
115 | - return array_map(function ($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) { |
|
115 | + return array_map(function($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) { |
|
116 | 116 | /** Page object to be passed to the Edit constructor. */ |
117 | 117 | $page = Page::newFromRow($pageRepo, $project, $rev); |
118 | 118 | $rev['user'] = $user; |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | // Must have underscores for the link to properly go to the section. |
359 | 359 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
360 | 360 | |
361 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
362 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
361 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
362 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
363 | 363 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
364 | 364 | } |
365 | 365 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | public function getDiffUrl(): string |
408 | 408 | { |
409 | - return rtrim($this->getProject()->getUrlForPage('Special:Diff/' . $this->id), '/'); |
|
409 | + return rtrim($this->getProject()->getUrlForPage('Special:Diff/'.$this->id), '/'); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | public function getPermaUrl(): string |
417 | 417 | { |
418 | - return rtrim($this->getProject()->getUrlForPage('Special:PermaLink/' . $this->id), '/'); |
|
418 | + return rtrim($this->getProject()->getUrlForPage('Special:PermaLink/'.$this->id), '/'); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -494,10 +494,10 @@ discard block |
||
494 | 494 | $ret['reverted'] = $this->reverted; |
495 | 495 | } |
496 | 496 | if ($includeUsername) { |
497 | - $ret = [ 'username' => $this->getUser()->getUsername() ] + $ret; |
|
497 | + $ret = ['username' => $this->getUser()->getUsername()]+$ret; |
|
498 | 498 | } |
499 | 499 | if ($includeProject) { |
500 | - $ret = [ 'project' => $this->getProject()->getDomain() ] + $ret; |
|
500 | + $ret = ['project' => $this->getProject()->getDomain()]+$ret; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | return $ret; |
@@ -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 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | return $this->cache->getItem($cacheKey)->get(); |
81 | 81 | } |
82 | 82 | |
83 | - $uri = 'https://meta.wikimedia.org/w/api.php?' . http_build_query([ |
|
83 | + $uri = 'https://meta.wikimedia.org/w/api.php?'.http_build_query([ |
|
84 | 84 | 'action' => 'query', |
85 | 85 | 'prop' => 'revisions', |
86 | 86 | 'rvprop' => 'content', |
87 | 87 | 'rvslots' => 'main', |
88 | 88 | 'format' => 'json', |
89 | 89 | 'formatversion' => 2, |
90 | - 'titles' => 'MediaWiki:XTools-AutoEdits.json' . ($useSandbox ? '/sandbox' : ''), |
|
90 | + 'titles' => 'MediaWiki:XTools-AutoEdits.json'.($useSandbox ? '/sandbox' : ''), |
|
91 | 91 | ]); |
92 | 92 | |
93 | 93 | if ($useSandbox && $this->session->get('logged_in_user')) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | // Once last walk through for some tidying up and validation. |
153 | 153 | $invalid = []; |
154 | - array_walk($this->tools[$projectDomain], function (&$data, $tool) use (&$invalid): void { |
|
154 | + array_walk($this->tools[$projectDomain], function(&$data, $tool) use (&$invalid): void { |
|
155 | 155 | // Populate the 'label' with the tool name, if a label doesn't already exist. |
156 | 156 | $data['label'] = $data['label'] ?? $tool; |
157 | 157 | |
@@ -235,14 +235,14 @@ discard block |
||
235 | 235 | |
236 | 236 | $revertEntries = array_filter( |
237 | 237 | $this->getTools($project), |
238 | - function ($tool) { |
|
238 | + function($tool) { |
|
239 | 239 | return isset($tool['revert']) && isset($tool['regex']); |
240 | 240 | } |
241 | 241 | ); |
242 | 242 | |
243 | 243 | // If 'revert' is set to `true`, then use 'regex' as the regular expression, |
244 | 244 | // otherwise 'revert' is assumed to be the regex string. |
245 | - $this->revertTools[$projectDomain] = array_map(function ($revertTool) { |
|
245 | + $this->revertTools[$projectDomain] = array_map(function($revertTool) { |
|
246 | 246 | return [ |
247 | 247 | 'link' => $revertTool['link'], |
248 | 248 | 'regex' => true === $revertTool['revert'] ? $revertTool['regex'] : $revertTool['revert'], |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | throw new XtoolsHttpException( |
297 | 297 | $this->i18n->msg('not-opted-in', [ |
298 | 298 | $this->getOptedInPage()->getTitle(), |
299 | - $this->i18n->msg('not-opted-in-link') . |
|
299 | + $this->i18n->msg('not-opted-in-link'). |
|
300 | 300 | ' <https://www.mediawiki.org/wiki/Special:MyLanguage/XTools/Edit_Counter#restricted_stats>', |
301 | 301 | $this->i18n->msg('not-opted-in-login'), |
302 | 302 | ]), |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | } |
581 | 581 | |
582 | 582 | throw new XtoolsHttpException( |
583 | - $this->i18n->msg('too-many-edits', [ $user->maxEdits() ]), |
|
583 | + $this->i18n->msg('too-many-edits', [$user->maxEdits()]), |
|
584 | 584 | $this->generateUrl($this->tooHighEditCountRoute(), $this->params), |
585 | 585 | $originalParams, |
586 | 586 | $this->isApi, |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $params = $this->convertLegacyParams($params); |
729 | 729 | |
730 | 730 | // Remove blank values. |
731 | - return array_filter($params, function ($param) { |
|
731 | + return array_filter($params, function($param) { |
|
732 | 732 | // 'namespace' or 'username' could be '0'. |
733 | 733 | return null !== $param && '' !== $param; |
734 | 734 | }); |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | // Show warnings that the date range was truncated. |
787 | 787 | $this->addFlashMessage('warning', 'date-range-too-wide', [$this->maxDays()]); |
788 | 788 | |
789 | - $startTime = strtotime('-' . $this->maxDays() . ' days', $endTime); |
|
789 | + $startTime = strtotime('-'.$this->maxDays().' days', $endTime); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | return [$startTime, $endTime]; |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | } |
959 | 959 | |
960 | 960 | $elapsedTime = round( |
961 | - microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], |
|
961 | + microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], |
|
962 | 962 | 3 |
963 | 963 | ); |
964 | 964 | return array_merge($params, ['elapsed_time' => $elapsedTime]); |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array |
989 | 989 | { |
990 | 990 | // Add full_page_title (in addition to the existing page_title and namespace keys). |
991 | - $out[$key] = array_map(function ($rev) { |
|
991 | + $out[$key] = array_map(function($rev) { |
|
992 | 992 | return array_merge([ |
993 | 993 | 'full_page_title' => $this->getPageFromNsAndTitle( |
994 | 994 | (int)$rev['namespace'], |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | */ |
1061 | 1061 | protected function addApiWarningAboutDates(array $keys): void |
1062 | 1062 | { |
1063 | - $this->addFlash('warning', 'In XTools 3.20, the ' . $this->i18n->getIntuition()->listToText($keys) . |
|
1063 | + $this->addFlash('warning', 'In XTools 3.20, the '.$this->i18n->getIntuition()->listToText($keys). |
|
1064 | 1064 | ' properties will be returned in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ'); |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | */ |
1070 | 1070 | protected function addApiWarningAboutPageTitles(): void |
1071 | 1071 | { |
1072 | - $this->addFlash('warning', 'In XTools 3.20, full_page_title and page_title will return ' . |
|
1072 | + $this->addFlash('warning', 'In XTools 3.20, full_page_title and page_title will return '. |
|
1073 | 1073 | 'page titles with spaces instead of underscores.'); |
1074 | 1074 | } |
1075 | 1075 | } |
@@ -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 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // Find the path, and complain if English doesn't exist. |
57 | - $path = $this->projectDir . '/i18n'; |
|
57 | + $path = $this->projectDir.'/i18n'; |
|
58 | 58 | if (!file_exists("$path/en.json")) { |
59 | 59 | throw new Exception("Language directory doesn't exist: $path"); |
60 | 60 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $messageFiles = glob($this->projectDir.'/i18n/*.json'); |
106 | 106 | |
107 | 107 | $languages = array_values(array_unique(array_map( |
108 | - function ($filename) { |
|
108 | + function($filename) { |
|
109 | 109 | return basename($filename, '.json'); |
110 | 110 | }, |
111 | 111 | $messageFiles |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->getIntuition()->getLangFallbacks($useLang) |
150 | 150 | ); |
151 | 151 | |
152 | - return array_filter($fallbacks, function ($lang) use ($i18nPath) { |
|
152 | + return array_filter($fallbacks, function($lang) use ($i18nPath) { |
|
153 | 153 | return is_file($i18nPath.$lang.'.json'); |
154 | 154 | }); |
155 | 155 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | private function getLangForTranslatingNumerals(): string |
289 | 289 | { |
290 | - return 'ar' === $this->getIntuition()->getLang() ? 'en': $this->getIntuition()->getLang(); |
|
290 | + return 'ar' === $this->getIntuition()->getLang() ? 'en' : $this->getIntuition()->getLang(); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -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; |
@@ -1319,10 +1319,10 @@ |
||
1319 | 1319 | // Slice to the top 10. |
1320 | 1320 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
1321 | 1321 | |
1322 | - // Get the sum of added text so that we can add in percentages. |
|
1323 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
1324 | - return $this->editors[$editor]['added']; |
|
1325 | - }, $topTenEditorsByAdded)); |
|
1322 | + // Get the sum of added text so that we can add in percentages. |
|
1323 | + $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
1324 | + return $this->editors[$editor]['added']; |
|
1325 | + }, $topTenEditorsByAdded)); |
|
1326 | 1326 | |
1327 | 1327 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
1328 | 1328 | return array_map(function ($editor) use ($topTenTotalAdded) { |
@@ -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 | |
@@ -958,16 +958,16 @@ discard block |
||
958 | 958 | |
959 | 959 | if ($info['all'] > 1) { |
960 | 960 | // Number of seconds/days between first and last edit. |
961 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
961 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
962 | 962 | $days = $secs / (60 * 60 * 24); |
963 | 963 | |
964 | 964 | // Average time between edits (in days). |
965 | - $this->editors[$editor]['atbe'] = round($days / ($info['all'] - 1), 1); |
|
965 | + $this->editors[$editor]['atbe'] = round($days / ($info['all']-1), 1); |
|
966 | 966 | } |
967 | 967 | } |
968 | 968 | |
969 | 969 | // Loop through again and add percentages. |
970 | - $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) { |
|
970 | + $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) { |
|
971 | 971 | $editor['percentage'] = 100 * ($editor['value'] / $topTenCount); |
972 | 972 | return $editor; |
973 | 973 | }, $topTenEditorsByEdits); |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | { |
986 | 986 | // First sort editors array by the amount of text they added. |
987 | 987 | $topTenEditorsByAdded = $this->editors; |
988 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
988 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
989 | 989 | if ($a['added'] === $b['added']) { |
990 | 990 | return 0; |
991 | 991 | } |
@@ -996,12 +996,12 @@ discard block |
||
996 | 996 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
997 | 997 | |
998 | 998 | // Get the sum of added text so that we can add in percentages. |
999 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
999 | + $topTenTotalAdded = array_sum(array_map(function($editor) { |
|
1000 | 1000 | return $this->editors[$editor]['added']; |
1001 | 1001 | }, $topTenEditorsByAdded)); |
1002 | 1002 | |
1003 | 1003 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
1004 | - return array_map(function ($editor) use ($topTenTotalAdded) { |
|
1004 | + return array_map(function($editor) use ($topTenTotalAdded) { |
|
1005 | 1005 | $added = $this->editors[$editor]['added']; |
1006 | 1006 | return [ |
1007 | 1007 | 'label' => $editor, |