Passed
Push — articleinfo-bot-percentages ( 0613da )
by MusikAnimal
09:12
created
src/AppBundle/Repository/BlameRepository.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/Model/Blame.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/PageRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the PageRepository class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Repository;
9 9
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
         $wikidataId = ltrim($page->getWikidataId(), 'Q');
308 308
 
309
-        $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . "
309
+        $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')."
310 310
                 FROM wikidatawiki_p.wb_items_per_site
311 311
                 WHERE ips_item_id = :wikidataId";
312 312
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             'wikidataId' => $wikidataId,
315 315
         ])->fetchAll();
316 316
 
317
-        return $count ? (int) $result[0]['count'] : $result;
317
+        return $count ? (int)$result[0]['count'] : $result;
318 318
     }
319 319
 
320 320
     /**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
         // Transform to associative array by 'type'
354 354
         foreach ($res as $row) {
355
-            $data[$row['type'] . '_count'] = (int)$row['value'];
355
+            $data[$row['type'].'_count'] = (int)$row['value'];
356 356
         }
357 357
 
358 358
         return $data;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
         $project = $page->getProject()->getDomain();
398 398
 
399
-        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' .
399
+        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'.
400 400
             "$project/all-access/user/$title/daily/$start/$end";
401 401
 
402 402
         $res = $client->request('GET', $url);
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
             $normalized = [];
472 472
             if (isset($result['query']['normalized'])) {
473 473
                 array_map(
474
-                    function ($e) use (&$normalized): void {
474
+                    function($e) use (&$normalized): void {
475 475
                         $normalized[$e['to']] = $e['from'];
476 476
                     },
477 477
                     $result['query']['normalized']
Please login to merge, or discard this patch.
src/AppBundle/Repository/ArticleInfoRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the ArticleInfoRepository class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Repository;
9 9
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp'
86 86
                 FROM $loggingTable
87
-                WHERE log_namespace = '" . $page->getNamespace() . "'
87
+                WHERE log_namespace = '".$page->getNamespace()."'
88 88
                 AND log_title = :title AND log_timestamp > 1 $datesConditions
89 89
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
90 90
         $title = str_replace(' ', '_', $page->getTitle());
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $time2 = time();
266 266
 
267 267
         // If it took over 5 seconds, cache the result for 20 minutes.
268
-        if ($time2 - $time1 > 5) {
268
+        if ($time2-$time1 > 5) {
269 269
             $this->setCache($cacheKey, $result, 'PT20M');
270 270
         }
271 271
 
Please login to merge, or discard this patch.
src/AppBundle/Controller/TopEditsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
         // Send all to the template.
167 167
         return $this->getFormattedResponse('topedits/result_article', [
168 168
             'xtPage' => 'TopEdits',
169
-            'xtTitle' => $this->user->getUsername() . ' - ' . $this->page->getTitle(),
169
+            'xtTitle' => $this->user->getUsername().' - '.$this->page->getTitle(),
170 170
             'te' => $topEdits,
171 171
         ]);
172 172
     }
Please login to merge, or discard this patch.
src/AppBundle/Model/AutoEdits.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the AutoEdits class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
     public function getToolsTotal(): int
226 226
     {
227 227
         if (!is_int($this->toolsTotal)) {
228
-            $this->toolsTotal = array_reduce($this->getToolCounts(), function ($a, $b) {
229
-                return $a + $b['count'];
228
+            $this->toolsTotal = array_reduce($this->getToolCounts(), function($a, $b) {
229
+                return $a+$b['count'];
230 230
             });
231 231
         }
232 232
 
Please login to merge, or discard this patch.
src/AppBundle/Twig/AppExtension.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the AppExtension class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Twig;
9 9
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     public function requestTime(): float
113 113
     {
114 114
         if (!isset($this->requestTime)) {
115
-            $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT');
115
+            $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT');
116 116
         }
117 117
 
118 118
         return $this->requestTime;
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         }
552 552
 
553 553
         $sizeMessage = $this->numberFormat(
554
-            pow(1024, $base - floor($base)),
554
+            pow(1024, $base-floor($base)),
555 555
             $precision
556 556
         );
557 557
 
@@ -708,15 +708,15 @@  discard block
 block discarded – undo
708 708
 
709 709
         if ($seconds >= 86400) {
710 710
             // Over a day
711
-            $val = (int) floor($seconds / 86400);
711
+            $val = (int)floor($seconds / 86400);
712 712
             $key = 'days';
713 713
         } elseif ($seconds >= 3600) {
714 714
             // Over an hour, less than a day
715
-            $val = (int) floor($seconds / 3600);
715
+            $val = (int)floor($seconds / 3600);
716 716
             $key = 'hours';
717 717
         } elseif ($seconds >= 60) {
718 718
             // Over a minute, less than an hour
719
-            $val = (int) floor($seconds / 60);
719
+            $val = (int)floor($seconds / 60);
720 720
             $key = 'minutes';
721 721
         }
722 722
 
Please login to merge, or discard this patch.
src/AppBundle/Model/Page.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the Page class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $title = $info['title'] ?? $this->unnormalizedPageName;
114 114
         $nsName = $this->getNamespaceName();
115 115
         return $nsName
116
-            ? str_replace($nsName . ':', '', $title)
116
+            ? str_replace($nsName.':', '', $title)
117 117
             : $title;
118 118
     }
119 119
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     {
313 313
         $content = $this->getRepository()->getPagesWikitext(
314 314
             $this->getProject(),
315
-            [ $this->getTitle() ]
315
+            [$this->getTitle()]
316 316
         );
317 317
 
318 318
         return $content[$this->getTitle()] ?? null;
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 
379 379
         $wikidataInfo = $this->getRepository()->getWikidataInfo($this);
380 380
 
381
-        $terms = array_map(function ($entry) {
381
+        $terms = array_map(function($entry) {
382 382
             return $entry['term'];
383 383
         }, $wikidataInfo);
384 384
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
                 'prio' => 2,
390 390
                 'name' => 'Wikidata',
391 391
                 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n
392
-                'explanation' => "See: <a target='_blank' " .
392
+                'explanation' => "See: <a target='_blank' ".
393 393
                     "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>",
394 394
             ];
395 395
         }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
                 'prio' => 3,
400 400
                 'name' => 'Wikidata',
401 401
                 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n
402
-                'explanation' => "See: <a target='_blank' " .
402
+                'explanation' => "See: <a target='_blank' ".
403 403
                     "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>",
404 404
             ];
405 405
         }
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             return 0;
478 478
         }
479 479
 
480
-        return array_sum(array_map(function ($item) {
480
+        return array_sum(array_map(function($item) {
481 481
             return (int)$item['views'];
482 482
         }, $pageviews['items']));
483 483
     }
Please login to merge, or discard this patch.
src/AppBundle/Helper/AutomatedEditsHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the AutomatedEditsHelper class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Helper;
9 9
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         $session = $this->container->get('session');
88
-        $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title=' .
89
-            'MediaWiki:XTools-AutoEdits.json' . ($useSandbox ? '/sandbox' : '');
88
+        $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title='.
89
+            'MediaWiki:XTools-AutoEdits.json'.($useSandbox ? '/sandbox' : '');
90 90
 
91 91
         if ($useSandbox && $session->get('logged_in_user')) {
92 92
             // Request via OAuth to get around server-side caching.
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
         // Once last walk through for some tidying up and validation.
151 151
         $invalid = [];
152
-        array_walk($this->tools[$projectDomain], function (&$data, $tool) use (&$invalid): void {
152
+        array_walk($this->tools[$projectDomain], function(&$data, $tool) use (&$invalid): void {
153 153
             // Populate the 'label' with the tool name, if a label doesn't already exist.
154 154
             $data['label'] = $data['label'] ?? $tool;
155 155
 
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 
234 234
         $revertEntries = array_filter(
235 235
             $this->getTools($project),
236
-            function ($tool) {
236
+            function($tool) {
237 237
                 return isset($tool['revert']) && isset($tool['regex']);
238 238
             }
239 239
         );
240 240
 
241 241
         // If 'revert' is set to `true`, then use 'regex' as the regular expression,
242 242
         //  otherwise 'revert' is assumed to be the regex string.
243
-        $this->revertTools[$projectDomain] = array_map(function ($revertTool) {
243
+        $this->revertTools[$projectDomain] = array_map(function($revertTool) {
244 244
             return [
245 245
                 'link' => $revertTool['link'],
246 246
                 'regex' => true === $revertTool['revert'] ? $revertTool['regex'] : $revertTool['revert'],
Please login to merge, or discard this patch.