Test Failed
Push — master ( b294c0...d4cc1f )
by MusikAnimal
03:12
created
src/Xtools/ArticleInfoRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $datesConditions = $this->getDateConditions($start, $end);
30 30
 
31 31
         $sql = "SELECT COUNT(DISTINCT(rev_id)) AS count, rev_user_text AS username, ug_group AS current
32
-                FROM " . $project->getTableName('revision') . "
32
+                FROM " . $project->getTableName('revision')."
33 33
                 LEFT JOIN $userGroupsTable ON rev_user = ug_user
34 34
                 LEFT JOIN $userFormerGroupsTable ON rev_user = ufg_user
35 35
                 WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot') $datesConditions
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp'
58 58
                 FROM $loggingTable
59
-                WHERE log_namespace = '" . $page->getNamespace() . "'
59
+                WHERE log_namespace = '".$page->getNamespace()."'
60 60
                 AND log_title = :title AND log_timestamp > 1 $datesConditions
61 61
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
62 62
         $title = str_replace(' ', '_', $page->getTitle());
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         $projectLang = $page->getProject()->getLang();
81 81
 
82
-        $url = "https://api.wikiwho.net/$projectLang/api/v1.0.0-beta/rev_content/" .
82
+        $url = "https://api.wikiwho.net/$projectLang/api/v1.0.0-beta/rev_content/".
83 83
             "$title/?o_rev_id=false&editor=true&token_id=false&out=false&in=false";
84 84
 
85 85
         $res = $client->request('GET', $url, ['http_errors' => false]);
Please login to merge, or discard this patch.
src/AppBundle/EventSubscriber/RateLimitSubscriber.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function onKernelController(FilterControllerEvent $event)
58 58
     {
59
-        $this->rateLimit = (int) $this->container->getParameter('app.rate_limit_count');
60
-        $this->rateDuration = (int) $this->container->getParameter('app.rate_limit_time');
59
+        $this->rateLimit = (int)$this->container->getParameter('app.rate_limit_count');
60
+        $this->rateDuration = (int)$this->container->getParameter('app.rate_limit_time');
61 61
 
62 62
         // Zero values indicate the rate limiting feature should be disabled.
63 63
         if ($this->rateLimit === 0 || $this->rateDuration === 0) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         }
66 66
 
67 67
         $controller = $event->getController();
68
-        $loggedIn = (bool) $this->container->get('session')->get('logged_in_user');
68
+        $loggedIn = (bool)$this->container->get('session')->get('logged_in_user');
69 69
 
70 70
         /**
71 71
          * Rate limiting will not apply to these actions
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $cacheItem = $cache->getItem($cacheKey);
92 92
 
93 93
         // If increment value already in cache, or start with 1.
94
-        $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1;
94
+        $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1;
95 95
 
96 96
         // Check if limit has been exceeded, and if so, throw an error.
97 97
         if ($count > $this->rateLimit) {
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
         // Log the denied request
144 144
         $logger = $this->container->get('monolog.logger.rate_limit');
145 145
         $logger->info(
146
-            "<URI>: " . $request->getRequestUri() .
147
-            ($logComment != '' ? "\t<Reason>: $logComment" : '') .
148
-            "\t<User agent>: " . $request->headers->get('User-Agent')
146
+            "<URI>: ".$request->getRequestUri().
147
+            ($logComment != '' ? "\t<Reason>: $logComment" : '').
148
+            "\t<User agent>: ".$request->headers->get('User-Agent')
149 149
         );
150 150
 
151 151
         throw new TooManyRequestsHttpException(600, 'error-rate-limit', null, $this->rateDuration);
Please login to merge, or discard this patch.
src/AppBundle/Helper/AutomatedEditsHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,14 +157,14 @@
 block discarded – undo
157 157
 
158 158
         $revertEntries = array_filter(
159 159
             $this->getTools($project),
160
-            function ($tool) {
160
+            function($tool) {
161 161
                 return isset($tool['revert']);
162 162
             }
163 163
         );
164 164
 
165 165
         // If 'revert' is set to `true`, then use 'regex' as the regular expression,
166 166
         //  otherwise 'revert' is assumed to be the regex string.
167
-        $this->revertTools[$projectDomain] = array_map(function ($revertTool) {
167
+        $this->revertTools[$projectDomain] = array_map(function($revertTool) {
168 168
             return [
169 169
                 'link' => $revertTool['link'],
170 170
                 'regex' => $revertTool['revert'] === true ? $revertTool['regex'] : $revertTool['revert'],
Please login to merge, or discard this patch.
src/Xtools/AutoEdits.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      */
242 242
     private function getEditsFromRevs(array $revs)
243 243
     {
244
-        return array_map(function ($rev) {
244
+        return array_map(function($rev) {
245 245
             /* @var Page Page object to be passed to the Edit contructor. */
246 246
             $page = $this->getPageFromRev($rev);
247 247
             $rev['user'] = $this->user;
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
     public function getToolsTotal()
306 306
     {
307 307
         if (!is_int($this->toolsTotal)) {
308
-            $this->toolsTotal = array_reduce($this->getToolCounts(), function ($a, $b) {
309
-                return $a + $b['count'];
308
+            $this->toolsTotal = array_reduce($this->getToolCounts(), function($a, $b) {
309
+                return $a+$b['count'];
310 310
             });
311 311
         }
312 312
 
Please login to merge, or discard this patch.
src/Xtools/Edit.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch);
282 282
 
283 283
         if ($isSection && isset($page)) {
284
-            $pageUrl = $project->getUrl(false) . str_replace(
284
+            $pageUrl = $project->getUrl(false).str_replace(
285 285
                 '$1',
286 286
                 $page->getTitle($useUnnormalizedPageTitle),
287 287
                 $project->getArticlePath()
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
             // Must have underscores for the link to properly go to the section.
292 292
             $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle));
293 293
 
294
-            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</a>" .
295
-                "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> ";
294
+            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</a>".
295
+                "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> ";
296 296
             $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary);
297 297
         }
298 298
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             );
307 307
 
308 308
             // Use normalized page title (underscored, capitalized).
309
-            $pageUrl = $project->getUrl(false) . str_replace(
309
+            $pageUrl = $project->getUrl(false).str_replace(
310 310
                 '$1',
311 311
                 ucfirst(str_replace(' ', '_', $wikiLinkPath)),
312 312
                 $project->getArticlePath()
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
     public function getDiffUrl()
345 345
     {
346 346
         $project = $this->getProject();
347
-        $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath());
348
-        return rtrim($project->getUrl(), '/') . $path;
347
+        $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath());
348
+        return rtrim($project->getUrl(), '/').$path;
349 349
     }
350 350
 
351 351
     /**
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
     public function getPermaUrl()
356 356
     {
357 357
         $project = $this->getProject();
358
-        $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath());
359
-        return rtrim($project->getUrl(), '/') . $path;
358
+        $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath());
359
+        return rtrim($project->getUrl(), '/').$path;
360 360
     }
361 361
 
362 362
     /**
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      */
389 389
     public function isAutomated(Container $container)
390 390
     {
391
-        return (bool) $this->getTool($container);
391
+        return (bool)$this->getTool($container);
392 392
     }
393 393
 
394 394
     /**
Please login to merge, or discard this patch.
src/AppBundle/Twig/AppExtension.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     public function requestTime()
112 112
     {
113 113
         if (!isset($this->requestTime)) {
114
-            $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT');
114
+            $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT');
115 115
         }
116 116
 
117 117
         return $this->requestTime;
@@ -674,15 +674,15 @@  discard block
 block discarded – undo
674 674
 
675 675
         if ($seconds >= 86400) {
676 676
             // Over a day
677
-            $val = (int) floor($seconds / 86400);
677
+            $val = (int)floor($seconds / 86400);
678 678
             $key = 'days';
679 679
         } elseif ($seconds >= 3600) {
680 680
             // Over an hour, less than a day
681
-            $val = (int) floor($seconds / 3600);
681
+            $val = (int)floor($seconds / 3600);
682 682
             $key = 'hours';
683 683
         } elseif ($seconds >= 60) {
684 684
             // Over a minute, less than an hour
685
-            $val = (int) floor($seconds / 60);
685
+            $val = (int)floor($seconds / 60);
686 686
             $key = 'minutes';
687 687
         }
688 688
 
Please login to merge, or discard this patch.
src/Xtools/PageRepository.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         // supply as the OFFSET.
152 152
         $limitClause = '';
153 153
         if (intval($limit) > 0 && isset($numRevisions)) {
154
-            $offset = $numRevisions - $limit;
154
+            $offset = $numRevisions-$limit;
155 155
             $limitClause = "LIMIT $offset, $limit";
156 156
         }
157 157
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         $time2 = time();
290 290
 
291 291
         // If it took over 5 seconds, cache the result for 20 minutes.
292
-        if ($time2 - $time1 > 5) {
292
+        if ($time2-$time1 > 5) {
293 293
             $this->setCache($cacheKey, $result, 'PT20M');
294 294
         }
295 295
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 
409 409
         $wikidataId = ltrim($page->getWikidataId(), 'Q');
410 410
 
411
-        $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . "
411
+        $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')."
412 412
                 FROM wikidatawiki_p.wb_items_per_site
413 413
                 WHERE ips_item_id = :wikidataId";
414 414
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
             'wikidataId' => $wikidataId,
417 417
         ])->fetchAll();
418 418
 
419
-        return $count ? (int) $result[0]['count'] : $result;
419
+        return $count ? (int)$result[0]['count'] : $result;
420 420
     }
421 421
 
422 422
     /**
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
         // Transform to associative array by 'type'
456 456
         foreach ($res as $row) {
457
-            $data[$row['type'] . '_count'] = $row['value'];
457
+            $data[$row['type'].'_count'] = $row['value'];
458 458
         }
459 459
 
460 460
         return $data;
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
         $project = $page->getProject()->getDomain();
498 498
 
499
-        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' .
499
+        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'.
500 500
             "$project/all-access/user/$title/daily/$start/$end";
501 501
 
502 502
         $res = $client->request('GET', $url);
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
             $normalized = [];
569 569
             if (isset($result['query']['normalized'])) {
570 570
                 array_map(
571
-                    function ($e) use (&$normalized) {
571
+                    function($e) use (&$normalized) {
572 572
                         $normalized[$e['to']] = $e['from'];
573 573
                     },
574 574
                     $result['query']['normalized']
Please login to merge, or discard this patch.
src/AppBundle/Helper/I18nHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         }
73 73
 
74 74
         // Find the path, and complain if English doesn't exist.
75
-        $path = $this->container->getParameter('kernel.root_dir') . '/../i18n';
75
+        $path = $this->container->getParameter('kernel.root_dir').'/../i18n';
76 76
         if (!file_exists("$path/en.json")) {
77 77
             throw new Exception("Language directory doesn't exist: $path");
78 78
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $messageFiles = glob($this->container->getParameter('kernel.root_dir').'/../i18n/*.json');
128 128
 
129 129
         $languages = array_values(array_unique(array_map(
130
-            function ($filename) {
130
+            function($filename) {
131 131
                 return basename($filename, '.json');
132 132
             },
133 133
             $messageFiles
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $this->getIntuition()->getLangFallbacks($this->getLang())
170 170
         );
171 171
 
172
-        return array_filter($fallbacks, function ($lang) use ($i18nPath) {
172
+        return array_filter($fallbacks, function($lang) use ($i18nPath) {
173 173
             return is_file($i18nPath.$lang.'.json');
174 174
         });
175 175
     }
Please login to merge, or discard this patch.
src/AppBundle/Controller/CategoryEditsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
         // 'Category:', which sometimes is used cross-wiki (because it still works).
178 178
         $normalized = false;
179 179
         $nsName = $this->project->getNamespaces()[14].':';
180
-        $this->categories = array_map(function ($category) use ($nsName, &$normalized) {
180
+        $this->categories = array_map(function($category) use ($nsName, &$normalized) {
181 181
             if (strpos($category, $nsName) === 0 || strpos($category, 'Category:') === 0) {
182 182
                 $normalized = true;
183 183
             }
Please login to merge, or discard this patch.