Passed
Push — largest-pages ( d7d143...8c1662 )
by MusikAnimal
04:09
created
src/AppBundle/Model/ArticleInfoApi.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
         $refs = $crawler->filter('#mw-content-text .reference');
150 150
         $refContent = [];
151
-        $refs->each(function ($ref) use (&$refContent): void {
151
+        $refs->each(function($ref) use (&$refContent): void {
152 152
             $refContent[] = $ref->text();
153 153
         });
154 154
         $uniqueRefs = count(array_unique($refContent));
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         $totalChars = 0;
177 177
         $totalWords = 0;
178 178
         $paragraphs = $crawler->filter($selector);
179
-        $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void {
179
+        $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void {
180 180
             /** @var Crawler $node */
181 181
             $text = preg_replace('/\[\d+]/', '', trim($node->text(null, true)));
182 182
             $totalChars += strlen($text);
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         $data = [
241 241
             'project' => $project->getDomain(),
242 242
             'page' => $page->getTitle(),
243
-            'watchers' => (int) $page->getWatchers(),
243
+            'watchers' => (int)$page->getWatchers(),
244 244
             'pageviews' => $page->getLastPageviews($pageviewsOffset),
245 245
             'pageviews_offset' => $pageviewsOffset,
246 246
         ];
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         if (false !== $info) {
266 266
             $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
267 267
             $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
268
-            $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
268
+            $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
269 269
 
270 270
             // Some wikis (such foundation.wikimedia.org) may be missing the creation date.
271 271
             $creationDateTime = false === $creationDateTime
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
                 ->getAssessment($page);
278 278
 
279 279
             $data = array_merge($data, [
280
-                'revisions' => (int) $info['num_edits'],
281
-                'editors' => (int) $info['num_editors'],
282
-                'minor_edits' => (int) $info['minor_edits'],
280
+                'revisions' => (int)$info['num_edits'],
281
+                'editors' => (int)$info['num_editors'],
282
+                'minor_edits' => (int)$info['minor_edits'],
283 283
                 'author' => $info['author'],
284
-                'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'],
284
+                'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'],
285 285
                 'created_at' => $creationDateTime,
286 286
                 'created_rev_id' => $info['created_rev_id'],
287 287
                 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'),
288 288
                 'secs_since_last_edit' => $secsSinceLastEdit,
289
-                'last_edit_id' => (int) $info['modified_rev_id'],
289
+                'last_edit_id' => (int)$info['modified_rev_id'],
290 290
                 'assessment' => $assessment,
291 291
             ]);
292 292
         }
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
         }
437 437
 
438 438
         // Sort by edit count.
439
-        uasort($this->bots, function ($a, $b) {
440
-            return $b['count'] - $a['count'];
439
+        uasort($this->bots, function($a, $b) {
440
+            return $b['count']-$a['count'];
441 441
         });
442 442
 
443 443
         return $this->bots;
Please login to merge, or discard this patch.
src/AppBundle/Model/Edit.php 1 patch
Spacing   +10 added lines, -10 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
     /**
Please login to merge, or discard this patch.
src/AppBundle/Model/LargestPages.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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
 
Please login to merge, or discard this patch.
src/AppBundle/Repository/LargestPagesRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 namespace AppBundle\Repository;
5 5
 
Please login to merge, or discard this patch.
src/AppBundle/Controller/LargestPagesController.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
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $pages = [];
129 129
         foreach ($lp->getResults() as $index => $page) {
130 130
             $pages[] = [
131
-                'rank' => $index + 1,
131
+                'rank' => $index+1,
132 132
                 'page_title' => $page->getTitle(true),
133 133
                 'length' => $page->getLength(),
134 134
             ];
Please login to merge, or discard this patch.