Passed
Push — main ( eed5f3...fc48b6 )
by MusikAnimal
03:09
created
src/Model/ArticleInfoApi.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Model/TopEdits.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Repository/TopEditsRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Controller/AdminStatsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Model/Pages.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Repository/PagesRepository.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Model/Project.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Model/Edit.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'>&rarr;</a>" .
362
-                "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> ";
361
+            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Helper/AutomatedEditsHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'],
Please login to merge, or discard this patch.