@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the Edit class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function getEditsFromRevs(Project $project, User $user, array $revs): array |
88 | 88 | { |
89 | - return array_map(function ($rev) use ($project, $user) { |
|
89 | + return array_map(function($rev) use ($project, $user) { |
|
90 | 90 | /** @var Page $page Page object to be passed to the Edit constructor. */ |
91 | 91 | $page = Page::newFromRow($project, $rev); |
92 | 92 | $rev['user'] = $user; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
309 | 309 | |
310 | 310 | if ($isSection && isset($page)) { |
311 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
311 | + $pageUrl = $project->getUrl(false).str_replace( |
|
312 | 312 | '$1', |
313 | 313 | $page->getTitle($useUnnormalizedPageTitle), |
314 | 314 | $project->getArticlePath() |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | // Must have underscores for the link to properly go to the section. |
319 | 319 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
320 | 320 | |
321 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
322 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
321 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
322 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
323 | 323 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
324 | 324 | } |
325 | 325 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | ); |
334 | 334 | |
335 | 335 | // Use normalized page title (underscored, capitalized). |
336 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
336 | + $pageUrl = $project->getUrl(false).str_replace( |
|
337 | 337 | '$1', |
338 | 338 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
339 | 339 | $project->getArticlePath() |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | public function getDiffUrl(): string |
372 | 372 | { |
373 | 373 | $project = $this->getProject(); |
374 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
375 | - return rtrim($project->getUrl(), '/') . $path; |
|
374 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
375 | + return rtrim($project->getUrl(), '/').$path; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | public function getPermaUrl(): string |
383 | 383 | { |
384 | 384 | $project = $this->getProject(); |
385 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
386 | - return rtrim($project->getUrl(), '/') . $path; |
|
385 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
386 | + return rtrim($project->getUrl(), '/').$path; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | $ret['reverted'] = $this->reverted; |
467 | 467 | } |
468 | 468 | if ($includeUsername) { |
469 | - $ret = [ 'username' => $this->getUser()->getUsername() ] + $ret; |
|
469 | + $ret = ['username' => $this->getUser()->getUsername()]+$ret; |
|
470 | 470 | } |
471 | 471 | if ($includeProject) { |
472 | - $ret = [ 'project' => $this->getProject()->getDomain() ] + $ret; |
|
472 | + $ret = ['project' => $this->getProject()->getDomain()]+$ret; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | return $ret; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the AdminStats class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $stats = $this->groupStatsByUsername($stats); |
97 | 97 | |
98 | 98 | // Resort, as for some reason the SQL doesn't do this properly. |
99 | - uasort($stats, function ($a, $b) { |
|
99 | + uasort($stats, function($a, $b) { |
|
100 | 100 | if ($a['total'] === $b['total']) { |
101 | 101 | return 0; |
102 | 102 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->usersAndGroups = $this->project->getUsersInGroups($groupUserGroups['local'], $groupUserGroups['global']); |
128 | 128 | |
129 | 129 | // Populate $this->usersInGroup with users who are in the relevant user group for $this->group. |
130 | - $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function ($groups) { |
|
130 | + $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function($groups) { |
|
131 | 131 | return in_array($this->getRelevantUserGroup(), $groups); |
132 | 132 | })); |
133 | 133 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | if ($wikiPath) { |
153 | - $out = array_map(function ($url) { |
|
153 | + $out = array_map(function($url) { |
|
154 | 154 | return str_replace('.svg.png', '.svg', preg_replace('/.*\/18px-/', '', $url)); |
155 | 155 | }, $out); |
156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function numDays(): int |
166 | 166 | { |
167 | - return (int)(($this->end - $this->start) / 60 / 60 / 24) + 1; |
|
167 | + return (int)(($this->end-$this->start) / 60 / 60 / 24)+1; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -254,6 +254,6 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function getNumWithActionsNotInGroup(): int |
256 | 256 | { |
257 | - return count($this->adminStats) - $this->numWithActions; |
|
257 | + return count($this->adminStats)-$this->numWithActions; |
|
258 | 258 | } |
259 | 259 | } |
@@ -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) { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the ArticleInfo class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | |
976 | 976 | if ($info['all'] > 1) { |
977 | 977 | // Number of seconds/days between first and last edit. |
978 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
978 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
979 | 979 | $days = $secs / (60 * 60 * 24); |
980 | 980 | |
981 | 981 | // Average time between edits (in days). |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | } |
985 | 985 | |
986 | 986 | // Loop through again and add percentages. |
987 | - $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) { |
|
987 | + $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) { |
|
988 | 988 | $editor['percentage'] = 100 * ($editor['value'] / $topTenCount); |
989 | 989 | return $editor; |
990 | 990 | }, $topTenEditorsByEdits); |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | { |
1003 | 1003 | // First sort editors array by the amount of text they added. |
1004 | 1004 | $topTenEditorsByAdded = $this->editors; |
1005 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
1005 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
1006 | 1006 | if ($a['added'] === $b['added']) { |
1007 | 1007 | return 0; |
1008 | 1008 | } |
@@ -1013,12 +1013,12 @@ discard block |
||
1013 | 1013 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
1014 | 1014 | |
1015 | 1015 | // Get the sum of added text so that we can add in percentages. |
1016 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
1016 | + $topTenTotalAdded = array_sum(array_map(function($editor) { |
|
1017 | 1017 | return $this->editors[$editor]['added']; |
1018 | 1018 | }, $topTenEditorsByAdded)); |
1019 | 1019 | |
1020 | 1020 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
1021 | - return array_map(function ($editor) use ($topTenTotalAdded) { |
|
1021 | + return array_map(function($editor) use ($topTenTotalAdded) { |
|
1022 | 1022 | $added = $this->editors[$editor]['added']; |
1023 | 1023 | return [ |
1024 | 1024 | 'label' => $editor, |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the SimpleEditCounter class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getTotalEditCount(): int |
150 | 150 | { |
151 | - return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count'] + $this->data['live_edit_count']; |
|
151 | + return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count']+$this->data['live_edit_count']; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the EditSummary class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * This file contains only the Pages class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | $numResults = count($this->getResults()[$this->getNamespace()]); |
129 | - $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults - 1]['rev_timestamp']); |
|
129 | + $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults-1]['rev_timestamp']); |
|
130 | 130 | return $timestamp->format('Y-m-d\TH:i:s'); |
131 | 131 | } |
132 | 132 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Model; |
5 | 5 | |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | if ($sorted) { |
102 | 102 | // Sort. |
103 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
104 | - return $b['total'] - $a['total']; |
|
103 | + uasort($this->globalEditCounts, function($a, $b) { |
|
104 | + return $b['total']-$a['total']; |
|
105 | 105 | }); |
106 | 106 | } |
107 | 107 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $this->namespace, |
139 | 139 | $this->start, |
140 | 140 | $this->end, |
141 | - $this->limit + 1, |
|
141 | + $this->limit+1, |
|
142 | 142 | $this->offset |
143 | 143 | ); |
144 | 144 | $globalEdits = []; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * An RFX object contains the parsed information for an RFX |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - $final = []; // initialize the final array |
|
110 | + $final = []; // initialize the final array |
|
111 | 111 | $finalRaw = []; // Initialize the raw data array |
112 | 112 | |
113 | 113 | foreach (array_keys($this->data) as $key) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $final = array_count_values($final); // find repetition and its count |
122 | 122 | |
123 | - $final = array_diff($final, [1]); // remove single occurrences |
|
123 | + $final = array_diff($final, [1]); // remove single occurrences |
|
124 | 124 | |
125 | 125 | $this->duplicates = array_keys($final); |
126 | 126 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * This file contains only the PageAssessments class. |
4 | 4 | */ |
5 | 5 | |
6 | -declare(strict_types = 1); |
|
6 | +declare(strict_types=1); |
|
7 | 7 | |
8 | 8 | namespace App\Model; |
9 | 9 |