@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | User $user, |
99 | 99 | array $revs |
100 | 100 | ): array { |
101 | - return array_map(function ($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) { |
|
101 | + return array_map(function($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) { |
|
102 | 102 | /** Page object to be passed to the Edit constructor. */ |
103 | 103 | $page = Page::newFromRow($pageRepo, $project, $rev); |
104 | 104 | $rev['user'] = $user; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch); |
321 | 321 | |
322 | 322 | if ($isSection && isset($page)) { |
323 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
323 | + $pageUrl = $project->getUrl(false).str_replace( |
|
324 | 324 | '$1', |
325 | 325 | $page->getTitle($useUnnormalizedPageTitle), |
326 | 326 | $project->getArticlePath() |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | // Must have underscores for the link to properly go to the section. |
331 | 331 | $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle)); |
332 | 332 | |
333 | - $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>" . |
|
334 | - "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> "; |
|
333 | + $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>→</a>". |
|
334 | + "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> "; |
|
335 | 335 | $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary); |
336 | 336 | } |
337 | 337 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | ); |
346 | 346 | |
347 | 347 | // Use normalized page title (underscored, capitalized). |
348 | - $pageUrl = $project->getUrl(false) . str_replace( |
|
348 | + $pageUrl = $project->getUrl(false).str_replace( |
|
349 | 349 | '$1', |
350 | 350 | ucfirst(str_replace(' ', '_', $wikiLinkPath)), |
351 | 351 | $project->getArticlePath() |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | public function getDiffUrl(): string |
384 | 384 | { |
385 | 385 | $project = $this->getProject(); |
386 | - $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath()); |
|
387 | - return rtrim($project->getUrl(), '/') . $path; |
|
386 | + $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath()); |
|
387 | + return rtrim($project->getUrl(), '/').$path; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | public function getPermaUrl(): string |
395 | 395 | { |
396 | 396 | $project = $this->getProject(); |
397 | - $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath()); |
|
398 | - return rtrim($project->getUrl(), '/') . $path; |
|
397 | + $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath()); |
|
398 | + return rtrim($project->getUrl(), '/').$path; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
@@ -474,10 +474,10 @@ discard block |
||
474 | 474 | $ret['reverted'] = $this->reverted; |
475 | 475 | } |
476 | 476 | if ($includeUsername) { |
477 | - $ret = [ 'username' => $this->getUser()->getUsername() ] + $ret; |
|
477 | + $ret = ['username' => $this->getUser()->getUsername()]+$ret; |
|
478 | 478 | } |
479 | 479 | if ($includeProject) { |
480 | - $ret = [ 'project' => $this->getProject()->getDomain() ] + $ret; |
|
480 | + $ret = ['project' => $this->getProject()->getDomain()]+$ret; |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | 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\Model; |
6 | 6 | |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $now = new DateTime(); |
104 | 104 | $date = new DateTime($value); |
105 | 105 | $diff = $date->diff($now); |
106 | - $formula = 365 * (int)$diff->format('%y') + 30 * |
|
107 | - (int)$diff->format('%m') + (int)$diff->format('%d'); |
|
106 | + $formula = 365 * (int)$diff->format('%y')+30 * |
|
107 | + (int)$diff->format('%m')+(int)$diff->format('%d'); |
|
108 | 108 | if ($formula < 365) { |
109 | 109 | $this->multipliers['account-age-mult'] = 0; |
110 | 110 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - $multiplierKey = $row['source'] . '-mult'; |
|
115 | + $multiplierKey = $row['source'].'-mult'; |
|
116 | 116 | $multiplier = $this->multipliers[$multiplierKey] ?? 1; |
117 | 117 | $score = max(min($value * $multiplier, 100), -100); |
118 | 118 | $this->scores[$key]['mult'] = $multiplier; |
@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $stats = $this->groupStatsByUsername($stats); |
99 | 99 | |
100 | 100 | // Resort, as for some reason the SQL doesn't do this properly. |
101 | - uasort($stats, function ($a, $b) { |
|
101 | + uasort($stats, function($a, $b) { |
|
102 | 102 | if ($a['total'] === $b['total']) { |
103 | 103 | return 0; |
104 | 104 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $this->usersAndGroups = $this->project->getUsersInGroups($groupUserGroups['local'], $groupUserGroups['global']); |
127 | 127 | |
128 | 128 | // Populate $this->usersInGroup with users who are in the relevant user group for $this->group. |
129 | - $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function ($groups) { |
|
129 | + $this->usersInGroup = array_keys(array_filter($this->usersAndGroups, function($groups) { |
|
130 | 130 | return in_array($this->getRelevantUserGroup(), $groups); |
131 | 131 | })); |
132 | 132 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | if ($wikiPath) { |
152 | - $out = array_map(function ($url) { |
|
152 | + $out = array_map(function($url) { |
|
153 | 153 | return str_replace('.svg.png', '.svg', preg_replace('/.*\/18px-/', '', $url)); |
154 | 154 | }, $out); |
155 | 155 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function numDays(): int |
165 | 165 | { |
166 | - return (int)(($this->end - $this->start) / 60 / 60 / 24) + 1; |
|
166 | + return (int)(($this->end-$this->start) / 60 / 60 / 24)+1; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -253,6 +253,6 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getNumWithActionsNotInGroup(): int |
255 | 255 | { |
256 | - return count($this->adminStats) - $this->numWithActions; |
|
256 | + return count($this->adminStats)-$this->numWithActions; |
|
257 | 257 | } |
258 | 258 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Model; |
5 | 5 |
@@ -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 | } |
@@ -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 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getTotalEditCount(): int |
156 | 156 | { |
157 | - return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count'] + $this->data['live_edit_count']; |
|
157 | + return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count']+$this->data['live_edit_count']; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Model; |
5 | 5 |
@@ -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\Twig; |
6 | 6 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | public function requestTime(): float |
118 | 118 | { |
119 | 119 | if (!isset($this->requestTime)) { |
120 | - $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
120 | + $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $this->requestTime; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | $sizeMessage = $this->numberFormat( |
547 | - pow(1024, $base - floor($base)), |
|
547 | + pow(1024, $base-floor($base)), |
|
548 | 548 | $precision |
549 | 549 | ); |
550 | 550 | |
@@ -701,15 +701,15 @@ discard block |
||
701 | 701 | |
702 | 702 | if ($seconds >= 86400) { |
703 | 703 | // Over a day |
704 | - $val = (int) floor($seconds / 86400); |
|
704 | + $val = (int)floor($seconds / 86400); |
|
705 | 705 | $key = 'days'; |
706 | 706 | } elseif ($seconds >= 3600) { |
707 | 707 | // Over an hour, less than a day |
708 | - $val = (int) floor($seconds / 3600); |
|
708 | + $val = (int)floor($seconds / 3600); |
|
709 | 709 | $key = 'hours'; |
710 | 710 | } elseif ($seconds >= 60) { |
711 | 711 | // Over a minute, less than an hour |
712 | - $val = (int) floor($seconds / 60); |
|
712 | + $val = (int)floor($seconds / 60); |
|
713 | 713 | $key = 'minutes'; |
714 | 714 | } |
715 | 715 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\EventSubscriber; |
6 | 6 |