Test Failed
Push — globalcontribs-api-v2 ( 4e66c9 )
by MusikAnimal
07:27
created
src/AppBundle/Model/ArticleInfoApi.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 namespace AppBundle\Model;
5 5
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     public function getMaxRevisions(): int
90 90
     {
91 91
         if (!isset($this->maxRevisions)) {
92
-            $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions');
92
+            $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions');
93 93
         }
94 94
         return $this->maxRevisions;
95 95
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         $refs = $crawler->filter('#mw-content-text .reference');
171 171
         $refContent = [];
172
-        $refs->each(function ($ref) use (&$refContent): void {
172
+        $refs->each(function($ref) use (&$refContent): void {
173 173
             $refContent[] = $ref->text();
174 174
         });
175 175
         $uniqueRefs = count(array_unique($refContent));
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $totalChars = 0;
198 198
         $totalWords = 0;
199 199
         $paragraphs = $crawler->filter($selector);
200
-        $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void {
200
+        $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void {
201 201
             /** @var Crawler $node */
202 202
             $text = preg_replace('/\[\d+]/', '', trim($node->text(null, true)));
203 203
             $totalChars += strlen($text);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $data = [
262 262
             'project' => $project->getDomain(),
263 263
             'page' => $page->getTitle(),
264
-            'watchers' => (int) $page->getWatchers(),
264
+            'watchers' => (int)$page->getWatchers(),
265 265
             'pageviews' => $page->getLastPageviews($pageviewsOffset),
266 266
             'pageviews_offset' => $pageviewsOffset,
267 267
         ];
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         if (false !== $info) {
287 287
             $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
288 288
             $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
289
-            $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
289
+            $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
290 290
 
291 291
             // Some wikis (such foundation.wikimedia.org) may be missing the creation date.
292 292
             $creationDateTime = false === $creationDateTime
@@ -298,16 +298,16 @@  discard block
 block discarded – undo
298 298
                 ->getAssessment($page);
299 299
 
300 300
             $data = array_merge($data, [
301
-                'revisions' => (int) $info['num_edits'],
302
-                'editors' => (int) $info['num_editors'],
303
-                'minor_edits' => (int) $info['minor_edits'],
301
+                'revisions' => (int)$info['num_edits'],
302
+                'editors' => (int)$info['num_editors'],
303
+                'minor_edits' => (int)$info['minor_edits'],
304 304
                 'author' => $info['author'],
305
-                'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'],
305
+                'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'],
306 306
                 'created_at' => $creationDateTime,
307 307
                 'created_rev_id' => $info['created_rev_id'],
308 308
                 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'),
309 309
                 'secs_since_last_edit' => $secsSinceLastEdit,
310
-                'last_edit_id' => (int) $info['modified_rev_id'],
310
+                'last_edit_id' => (int)$info['modified_rev_id'],
311 311
                 'assessment' => $assessment,
312 312
             ]);
313 313
         }
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
         }
460 460
 
461 461
         // Sort by edit count.
462
-        uasort($this->bots, function ($a, $b) {
463
-            return $b['count'] - $a['count'];
462
+        uasort($this->bots, function($a, $b) {
463
+            return $b['count']-$a['count'];
464 464
         });
465 465
 
466 466
         return $this->bots;
Please login to merge, or discard this patch.
src/AppBundle/Controller/GlobalContribsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 namespace AppBundle\Controller;
5 5
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $this->project = $defaultProject;
192 192
 
193 193
         $results = $globalContribs->globalEdits();
194
-        $results = array_map(function (Edit $edit) {
194
+        $results = array_map(function(Edit $edit) {
195 195
             return $edit->getForJson(true, true);
196 196
         }, array_values($results));
197 197
         $results = $this->addFullPageTitlesAndContinue('globalcontribs', [], $results);
Please login to merge, or discard this patch.
src/AppBundle/Controller/AutomatedEditsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@
 block discarded – undo
272 272
             'total_editcount' => $this->autoEdits->getEditCount(),
273 273
             'automated_editcount' => $this->autoEdits->getAutomatedCount(),
274 274
         ];
275
-        $ret['nonautomated_editcount'] = $ret['total_editcount'] - $ret['automated_editcount'];
275
+        $ret['nonautomated_editcount'] = $ret['total_editcount']-$ret['automated_editcount'];
276 276
 
277 277
         if (isset($this->params['tools'])) {
278 278
             $tools = $this->autoEdits->getToolCounts();
Please login to merge, or discard this patch.
src/AppBundle/Controller/XtoolsController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             throw new XtoolsHttpException(
218 218
                 $this->i18n->msg('not-opted-in', [
219 219
                     $this->getOptedInPage()->getTitle(),
220
-                    $this->i18n->msg('not-opted-in-link') .
220
+                    $this->i18n->msg('not-opted-in-link').
221 221
                         ' <https://www.mediawiki.org/wiki/XTools/Edit_Counter#restricted_stats>',
222 222
                     $this->i18n->msg('not-opted-in-login'),
223 223
                 ]),
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      * Set cookies on the given Response.
264 264
      * @param Response $response
265 265
      */
266
-    private function setCookies(Response &$response): void
266
+    private function setCookies(Response & $response): void
267 267
     {
268 268
         // Not done for subrequests.
269 269
         if ($this->isSubRequest) {
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
         $params = $this->convertLegacyParams($params);
664 664
 
665 665
         // Remove blank values.
666
-        return array_filter($params, function ($param) {
666
+        return array_filter($params, function($param) {
667 667
             // 'namespace' or 'username' could be '0'.
668 668
             return null !== $param && '' !== $param;
669 669
         });
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
         }
865 865
 
866 866
         $elapsedTime = round(
867
-            microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT'),
867
+            microtime(true)-$this->request->server->get('REQUEST_TIME_FLOAT'),
868 868
             3
869 869
         );
870 870
 
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
     public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array
906 906
     {
907 907
         // Add full_page_title (in addition to the existing page_title and page_namespace keys).
908
-        $out[$key] = array_map(function ($rev) {
908
+        $out[$key] = array_map(function($rev) {
909 909
             return array_merge([
910 910
                 'full_page_title' => $this->getPageFromNsAndTitle(
911 911
                     (int)$rev['page_namespace'],
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         $conn = $this->container->get('doctrine')
942 942
             ->getManager('default')
943 943
             ->getConnection();
944
-        $date =  date('Y-m-d');
944
+        $date = date('Y-m-d');
945 945
 
946 946
         // Increment count in timeline
947 947
         $existsSql = "SELECT 1 FROM usage_api_timeline
Please login to merge, or discard this patch.
src/AppBundle/Model/Edit.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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 AppBundle\Model;
9 9
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'>&rarr;</a>" .
322
-                "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> ";
321
+            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.