@@ -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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | if ('all' !== $namespace) { |
53 | 53 | // Limit by namespace. |
54 | - return array_filter($this->aeTools, function (array $tool) use ($namespace) { |
|
54 | + return array_filter($this->aeTools, function(array $tool) use ($namespace) { |
|
55 | 55 | return empty($tool['namespaces']) || |
56 | 56 | in_array((int)$namespace, $tool['namespaces']) || |
57 | 57 | ( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $tagJoin = "LEFT OUTER JOIN $tagTable ON ct_rev_id = rev_id"; |
148 | 148 | $condTools[] = "ct_tag_id IN ($tagIds)"; |
149 | 149 | } |
150 | - $condTool = 'AND (' . implode(' OR ', $condTools) . ')'; |
|
150 | + $condTool = 'AND ('.implode(' OR ', $condTools).')'; |
|
151 | 151 | |
152 | 152 | $sql = "SELECT COUNT(DISTINCT(rev_id)) |
153 | 153 | FROM $revisionTable |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | } |
393 | 393 | |
394 | 394 | // Sort the array by count |
395 | - uasort($results, function ($a, $b) { |
|
396 | - return $b['count'] - $a['count']; |
|
395 | + uasort($results, function($a, $b) { |
|
396 | + return $b['count']-$a['count']; |
|
397 | 397 | }); |
398 | 398 | |
399 | 399 | // Cache and return. |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | if (isset($values['tags'])) { |
585 | 585 | $tags = array_merge( |
586 | 586 | $tags, |
587 | - array_map(function ($tag) use ($conn) { |
|
587 | + array_map(function($tag) use ($conn) { |
|
588 | 588 | return $conn->quote($tag, PDO::PARAM_STR); |
589 | 589 | }, $values['tags']) |
590 | 590 | ); |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | |
619 | 619 | if ($tagExcludes && 1 === count($tagIds)) { |
620 | 620 | // Get tag IDs, filtering out those for which no ID exists (meaning there is no local tag for that tool). |
621 | - $excludesList = implode(',', array_filter(array_map(function ($tagName) use ($project) { |
|
621 | + $excludesList = implode(',', array_filter(array_map(function($tagName) use ($project) { |
|
622 | 622 | return $this->getTags($project)[$tagName] ?? null; |
623 | 623 | }, $tagExcludes))); |
624 | 624 |
@@ -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 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp' |
146 | 146 | FROM $loggingTable |
147 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
147 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
148 | 148 | AND log_title = :title AND log_timestamp > 1 $datesConditions |
149 | 149 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
150 | 150 | $title = str_replace(' ', '_', $page->getTitle()); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $time2 = time(); |
328 | 328 | |
329 | 329 | // If it took over 5 seconds, cache the result for 20 minutes. |
330 | - if ($time2 - $time1 > 5) { |
|
330 | + if ($time2-$time1 > 5) { |
|
331 | 331 | $this->setCache($cacheKey, $result, 'PT20M'); |
332 | 332 | } |
333 | 333 |
@@ -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 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $numResults = count($this->getResults()[$this->getNamespace()]); |
130 | - $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults - 1]['rev_timestamp']); |
|
130 | + $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults-1]['rev_timestamp']); |
|
131 | 131 | return $timestamp->format('Y-m-d\TH:i:s'); |
132 | 132 | } |
133 | 133 |
@@ -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 | |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | public function getToolsTotal(): int |
265 | 265 | { |
266 | 266 | if (!isset($this->toolsTotal)) { |
267 | - $this->toolsTotal = array_reduce($this->getToolCounts(), function ($a, $b) { |
|
268 | - return $a + $b['count']; |
|
267 | + $this->toolsTotal = array_reduce($this->getToolCounts(), function($a, $b) { |
|
268 | + return $a+$b['count']; |
|
269 | 269 | }); |
270 | 270 | } |
271 | 271 |
@@ -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,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 | |
@@ -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 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | public function getScript(): string |
192 | 192 | { |
193 | 193 | $metadata = $this->getMetadata(); |
194 | - return $metadata['general']['script'] ?? $this->getScriptPath() . '/index.php'; |
|
194 | + return $metadata['general']['script'] ?? $this->getScriptPath().'/index.php'; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getApiUrl(): string |
202 | 202 | { |
203 | - return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath(); |
|
203 | + return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath(); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function userOptInPage(User $user): string |
277 | 277 | { |
278 | - return 'User:' . $user->getUsername() . '/EditCounterOptIn.js'; |
|
278 | + return 'User:'.$user->getUsername().'/EditCounterOptIn.js'; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | } |
310 | 310 | |
311 | 311 | // 4. Lastly, see if they've opted in globally on the default project or Meta. |
312 | - $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js'; |
|
312 | + $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js'; |
|
313 | 313 | $globalProject = $this->getRepository()->getGlobalProject(); |
314 | 314 | $globalExists = $globalProject->getRepository() |
315 | 315 | ->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 | |
@@ -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; |