@@ -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 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | if ($format) { |
| 266 | 266 | return $this->formatTopEditsPage($revs); |
| 267 | 267 | } else { |
| 268 | - return array_map(function ($rev) { |
|
| 268 | + return array_map(function($rev) { |
|
| 269 | 269 | $rev['minor'] = (bool)$rev['minor']; |
| 270 | 270 | $rev['reverted'] = (bool)$rev['reverted']; |
| 271 | 271 | return $rev; |
@@ -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 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $hasPageAssessments = $this->isWMF && $project->hasPageAssessments($namespace); |
| 115 | 115 | $paTable = $project->getTableName('page_assessments'); |
| 116 | 116 | $paSelect = $hasPageAssessments |
| 117 | - ? ", ( |
|
| 117 | + ? ", ( |
|
| 118 | 118 | SELECT pa_class |
| 119 | 119 | FROM $paTable |
| 120 | 120 | WHERE pa_page_id = page_id |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $hasPageAssessments = $this->isWMF && $project->hasPageAssessments(); |
| 229 | 229 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
| 230 | 230 | $paSelect = $hasPageAssessments |
| 231 | - ? ", ( |
|
| 231 | + ? ", ( |
|
| 232 | 232 | SELECT pa_class |
| 233 | 233 | FROM $pageAssessmentsTable |
| 234 | 234 | WHERE pa_page_id = e.page_id |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | $actionsRequested = is_array($actionsQuery) ? $actionsQuery : array_filter(explode('|', $actionsQuery)); |
| 147 | 147 | |
| 148 | 148 | // Filter out any invalid action names. |
| 149 | - $actions = array_filter($actionsRequested, function ($action) use ($group) { |
|
| 149 | + $actions = array_filter($actionsRequested, function($action) use ($group) { |
|
| 150 | 150 | return in_array($action, $this->getActionNames($group)); |
| 151 | 151 | }); |
| 152 | 152 | |
@@ -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'], |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | $this->addFlash('warning', 'In XTools 3.20, this endpoint will be renamed to /api/page/pageinfo'); |
| 275 | 275 | $this->addApiWarningAboutDates(['created_at', 'modified_at']); |
| 276 | - $this->addFlash('warning', 'In XTools 3.20, the author and author_editcount properties will be ' . |
|
| 276 | + $this->addFlash('warning', 'In XTools 3.20, the author and author_editcount properties will be '. |
|
| 277 | 277 | 'renamed to creator and creator_editcount, respectively.'); |
| 278 | 278 | $this->addFlash('warning', 'In XTools 3.20, the last_edit_id property will be renamed to modified_rev_id'); |
| 279 | - $this->addFlash('warning', 'In XTools 3.20, the watchers property will return null instead of 0 ' . |
|
| 279 | + $this->addFlash('warning', 'In XTools 3.20, the watchers property will return null instead of 0 '. |
|
| 280 | 280 | 'if the number of page watchers is unknown.'); |
| 281 | 281 | return $this->getFormattedApiResponse($data); |
| 282 | 282 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $responseCode = Response::HTTP_OK; |
| 350 | 350 | $this->recordApiUsage('page/prose'); |
| 351 | 351 | $this->setupArticleInfo($articleInfoRepo, $autoEditsHelper); |
| 352 | - $this->addFlash('info', 'The algorithm used by this API has recently changed. ' . |
|
| 352 | + $this->addFlash('info', 'The algorithm used by this API has recently changed. '. |
|
| 353 | 353 | 'See https://www.mediawiki.org/wiki/XTools/Page_History#Prose for details.'); |
| 354 | 354 | $ret = $this->articleInfo->getProseStats(); |
| 355 | 355 | if (null === $ret) { |