Completed
Branch master (9b3357)
by Matthew
11:19
created
src/AppBundle/Controller/AdminScoreController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6 6
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7 7
 use Symfony\Component\HttpFoundation\Request;
8
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9 8
 use DateTime;
10 9
 
11 10
 class AdminScoreController extends Controller
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
         $username = $request->query->get('user');
28 28
 
29 29
         if ($projectQuery != "" && $username != "") {
30
-            return $this->redirectToRoute("AdminScoreResult", [ 'project'=>$projectQuery, 'username' => $username ]);
30
+            return $this->redirectToRoute("AdminScoreResult", ['project'=>$projectQuery, 'username' => $username]);
31 31
         } elseif ($projectQuery != "") {
32
-            return $this->redirectToRoute("AdminScoreProject", [ 'project'=>$projectQuery ]);
32
+            return $this->redirectToRoute("AdminScoreProject", ['project'=>$projectQuery]);
33 33
         }
34 34
 
35 35
         // Otherwise fall through.
@@ -67,20 +67,20 @@  discard block
 block discarded – undo
67 67
         $archiveTable = $lh->getTable("archive", $dbName);
68 68
 
69 69
         // MULTIPLIERS (to review)
70
-        $ACCT_AGE_MULT = 1.25;   # 0 if = 365 jours
71
-        $EDIT_COUNT_MULT = 1.25;     # 0 if = 10 000
72
-        $USER_PAGE_MULT = 0.1;     # 0 if =
70
+        $ACCT_AGE_MULT = 1.25; # 0 if = 365 jours
71
+        $EDIT_COUNT_MULT = 1.25; # 0 if = 10 000
72
+        $USER_PAGE_MULT = 0.1; # 0 if =
73 73
         $PATROLS_MULT = 1; # 0 if =
74
-        $BLOCKS_MULT = 1.4;     # 0 if = 10
74
+        $BLOCKS_MULT = 1.4; # 0 if = 10
75 75
         $AFD_MULT = 1.15;
76
-        $RECENT_ACTIVITY_MULT = 0.9;     # 0 if =
76
+        $RECENT_ACTIVITY_MULT = 0.9; # 0 if =
77 77
         $AIV_MULT = 1.15;
78
-        $EDIT_SUMMARIES_MULT = 0.8;   # 0 if =
79
-        $NAMESPACES_MULT = 1.0;     # 0 if =
78
+        $EDIT_SUMMARIES_MULT = 0.8; # 0 if =
79
+        $NAMESPACES_MULT = 1.0; # 0 if =
80 80
         $PAGES_CREATED_LIVE_MULT = 1.4; # 0 if =
81 81
         $PAGES_CREATED_ARCHIVE_MULT = 1.4; # 0 if =
82
-        $RPP_MULT = 1.15;     # 0 if =
83
-        $USERRIGHTS_MULT = 0.75;   # 0 if =
82
+        $RPP_MULT = 1.15; # 0 if =
83
+        $USERRIGHTS_MULT = 0.75; # 0 if =
84 84
 
85 85
         // Grab the connection to the replica database (which is separate from the above)
86 86
         $conn = $this->get('doctrine')->getManager("replicas")->getConnection();
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
                 $now = new DateTime();
155 155
                 $date = new DateTime($value);
156 156
                 $diff = $date->diff($now);
157
-                $formula = 365*$diff->format("%y")+30*$diff->format("%m")+$diff->format("%d");
157
+                $formula = 365 * $diff->format("%y")+30 * $diff->format("%m")+$diff->format("%d");
158 158
                 $value = $formula-365;
159 159
             }
160 160
 
161 161
             if ($key == "id") {
162 162
                 $id = $value;
163 163
             } else {
164
-                $multiplierKey = strtoupper($row["source"] . "_MULT");
165
-                $multiplier = ( isset($$multiplierKey) ? $$multiplierKey : 1 );
164
+                $multiplierKey = strtoupper($row["source"]."_MULT");
165
+                $multiplier = (isset($$multiplierKey) ? $$multiplierKey : 1);
166 166
                 $score = max(min($value * $multiplier, 100), -100);
167 167
                 $master[$key]["mult"] = $multiplier;
168 168
                 $master[$key]["value"] = $value;
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
         }
173 173
 
174 174
         if ($id == 0) {
175
-            $this->addFlash("notice", [ "noresult", $username ]);
176
-            return $this->redirectToRoute("AdminScore", [ "project"=>$project ]);
175
+            $this->addFlash("notice", ["noresult", $username]);
176
+            return $this->redirectToRoute("AdminScore", ["project"=>$project]);
177 177
         }
178 178
 
179 179
         // replace this example code with whatever you need
Please login to merge, or discard this patch.
src/AppBundle/Controller/ArticleInfoController.php 4 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,6 @@
 block discarded – undo
380 380
 
381 381
     /**
382 382
      * Get the size of the diff
383
-     * @param  int $rev The index of the revision within $this->pageHistory
384 383
      * @return int Size of the diff
385 384
      */
386 385
     private function getDiffSize($revIndex)
Please login to merge, or discard this patch.
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -6,11 +6,7 @@
 block discarded – undo
6 6
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7 7
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8 8
 use Symfony\Component\HttpFoundation\Request;
9
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
10 9
 use Symfony\Component\DependencyInjection\ContainerInterface;
11
-use AppBundle\Helper\Apihelper;
12
-use AppBundle\Helper\PageviewsHelper;
13
-use AppBundle\Helper\AutomatedEditsHelper;
14 10
 
15 11
 class ArticleInfoController extends Controller
16 12
 {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
     private function getRevCount()
165 165
     {
166 166
         $query = "SELECT COUNT(*) AS count FROM " . $this->revisionTable
167
-                 . " WHERE rev_page = '" . $this->pageInfo['id'] . "'";
167
+                    . " WHERE rev_page = '" . $this->pageInfo['id'] . "'";
168 168
         $res = $this->conn->query($query)->fetchAll();
169 169
         return $res[0]['count'];
170 170
     }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
         $article = $request->query->get('article');
56 56
 
57 57
         if ($projectQuery != '' && $article != '') {
58
-            return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]);
58
+            return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]);
59 59
         } elseif ($article != '') {
60
-            return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]);
60
+            return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]);
61 61
         }
62 62
 
63 63
         return $this->render('articleInfo/index.html.twig', [
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             'url' => $basicInfo['fullurl']
102 102
         ];
103 103
 
104
-        $this->pageInfo['watchers'] = ( isset($basicInfo['watchers']) ) ? $basicInfo['watchers'] : "< 30";
104
+        $this->pageInfo['watchers'] = (isset($basicInfo['watchers'])) ? $basicInfo['watchers'] : "< 30";
105 105
 
106 106
         $pageProps = isset($basicInfo['pageprops']) ? $basicInfo['pageprops'] : [];
107 107
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
      */
164 164
     private function getRevCount()
165 165
     {
166
-        $query = "SELECT COUNT(*) AS count FROM " . $this->revisionTable
167
-                 . " WHERE rev_page = '" . $this->pageInfo['id'] . "'";
166
+        $query = "SELECT COUNT(*) AS count FROM ".$this->revisionTable
167
+                 . " WHERE rev_page = '".$this->pageInfo['id']."'";
168 168
         $res = $this->conn->query($query)->fetchAll();
169 169
         return $res[0]['count'];
170 170
     }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                   FROM $this->revisionTable
197 197
                   LEFT JOIN $userGroupsTable ON rev_user = ug_user
198 198
                   LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user
199
-                  WHERE rev_page = " . $this->pageInfo['id'] . " AND (ug_group = 'bot' OR ufg_group = 'bot')
199
+                  WHERE rev_page = ".$this->pageInfo['id']." AND (ug_group = 'bot' OR ufg_group = 'bot')
200 200
                   GROUP BY rev_user_text";
201 201
         $res = $this->conn->query($query)->fetchAll();
202 202
 
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
         $sum = 0;
206 206
         foreach ($res as $bot) {
207 207
             $bots[$bot['username']] = [
208
-                'count' => (int) $bot['count'],
208
+                'count' => (int)$bot['count'],
209 209
                 'current' => $bot['current'] === 'bot'
210 210
             ];
211 211
             $sum += $bot['count'];
212 212
         }
213 213
 
214
-        uasort($bots, function ($a, $b) {
215
-            return $b['count'] - $a['count'];
214
+        uasort($bots, function($a, $b) {
215
+            return $b['count']-$a['count'];
216 216
         });
217 217
 
218 218
         $this->pageInfo['general']['bot_revision_count'] = $sum;
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 
249 249
             if ($info['all'] > 1) {
250 250
                 // Number of seconds between first and last edit
251
-                $secs = intval(strtotime($info['last']) - strtotime($info['first']) / $info['all']);
251
+                $secs = intval(strtotime($info['last'])-strtotime($info['first']) / $info['all']);
252 252
 
253 253
                 // Average time between edits (in days)
254
-                $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 );
254
+                $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24);
255 255
             }
256 256
 
257 257
             if (count($info['sizes'])) {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
         // Transform to associative array by 'type'
299 299
         foreach ($res as $row) {
300
-            $data[$row['type'] . '_count'] = $row['value'];
300
+            $data[$row['type'].'_count'] = $row['value'];
301 301
         }
302 302
 
303 303
         return $data;
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         $title = str_replace(' ', '_', $this->pageInfo['title']);
314 314
         $query = "SELECT log_action, log_type, log_timestamp AS timestamp
315 315
                   FROM $loggingTable
316
-                  WHERE log_namespace = '" . $this->pageInfo['namespace'] . "'
316
+                  WHERE log_namespace = '".$this->pageInfo['namespace']."'
317 317
                   AND log_title = '$title' AND log_timestamp > 1
318 318
                   AND log_type IN ('delete', 'move', 'protect', 'stable')";
319 319
         $events = $this->conn->query($query)->fetchAll();
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         $query = "SELECT rev_id, rev_parent_id, rev_user_text, rev_user, rev_timestamp,
372 372
                   rev_minor_edit, rev_len, rev_comment
373 373
                   FROM $this->revisionTable
374
-                  WHERE rev_page = '" . $this->pageInfo['id'] . "' AND rev_timestamp > 1
374
+                  WHERE rev_page = '".$this->pageInfo['id']."' AND rev_timestamp > 1
375 375
                   ORDER BY rev_timestamp";
376 376
 
377 377
         $res = $this->conn->query($query)->fetchAll();
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
             return $rev['rev_len'];
392 392
         }
393 393
 
394
-        $lastRev = $this->pageHistory[$revIndex - 1];
394
+        $lastRev = $this->pageHistory[$revIndex-1];
395 395
 
396
-        return $rev['rev_len'] - $lastRev['rev_len'];
396
+        return $rev['rev_len']-$lastRev['rev_len'];
397 397
     }
398 398
 
399 399
     /**
@@ -413,12 +413,12 @@  discard block
 block discarded – undo
413 413
         // The month of the first edit. Used as a comparison when building the per-month data
414 414
         $firstEditMonth = strtotime(date('Y-m-01, 00:00', strtotime($firstEdit['rev_timestamp'])));
415 415
 
416
-        $lastEdit = $this->pageHistory[ $revisionCount - 1 ];
417
-        $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[ $revisionCount - 2 ];
416
+        $lastEdit = $this->pageHistory[$revisionCount-1];
417
+        $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[$revisionCount-2];
418 418
 
419 419
         // Now we can start our master array. This one will be HUGE!
420 420
         $lastEditSize = ($revisionCount > 1)
421
-            ? $lastEdit['rev_len'] - $secondLastEdit['rev_len']
421
+            ? $lastEdit['rev_len']-$secondLastEdit['rev_len']
422 422
             : $lastEdit['rev_len'];
423 423
         $data = [
424 424
             'general' => [
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
             // Increment year and month counts for all edits
515 515
             $data['year_count'][$timestamp['year']]['all']++;
516 516
             $data['year_count'][$timestamp['year']]['months'][$timestamp['month']]['all']++;
517
-            $data['year_count'][$timestamp['year']]['size'] = (int) $rev['rev_len'];
517
+            $data['year_count'][$timestamp['year']]['size'] = (int)$rev['rev_len'];
518 518
 
519 519
             // Fill in various user stats
520 520
             if (!isset($data['editors'][$username])) {
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
                 }
554 554
 
555 555
                 // determine if the next revision was a revert
556
-                $nextRevision = isset($this->pageHistory[$i + 1]) ? $this->pageHistory[$i + 1] : null;
556
+                $nextRevision = isset($this->pageHistory[$i+1]) ? $this->pageHistory[$i+1] : null;
557 557
                 $nextRevisionIsRevert = $nextRevision &&
558
-                    $this->getDiffSize($i + 1) === -$diffSize &&
558
+                    $this->getDiffSize($i+1) === -$diffSize &&
559 559
                     $this->aeh->isRevert($nextRevision['rev_comment']);
560 560
 
561 561
                 // don't count this edit as content removal if the next edit reverted it
Please login to merge, or discard this patch.
src/AppBundle/Controller/DefaultController.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6 6
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
-use Symfony\Component\HttpFoundation\Request;
8 7
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9 8
 
10 9
 class DefaultController extends Controller
Please login to merge, or discard this patch.
src/AppBundle/Controller/PagesController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6 6
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7 7
 use Symfony\Component\HttpFoundation\Request;
8
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9 8
 
10 9
 class PagesController extends Controller
11 10
 {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 'username' => $username,
57 57
             ]);
58 58
         } elseif ($projectQuery != "") {
59
-            return $this->redirectToRoute("PagesProject", [ 'project'=>$projectQuery ]);
59
+            return $this->redirectToRoute("PagesProject", ['project'=>$projectQuery]);
60 60
         }
61 61
 
62 62
         // Retrieving the global groups, using the ApiHelper class
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
         }
219 219
 
220 220
         if ($total < 1) {
221
-            $this->addFlash("notice", [ "noresult", $username ]);
222
-            return $this->redirectToRoute("PagesProject", [ "project"=>$project ]);
221
+            $this->addFlash("notice", ["noresult", $username]);
222
+            return $this->redirectToRoute("PagesProject", ["project"=>$project]);
223 223
         }
224 224
 
225 225
         ksort($pagesArray);
Please login to merge, or discard this patch.
src/AppBundle/Controller/SimpleEditCounterController.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6 6
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
-use Symfony\Component\Config\Definition\Exception\Exception;
8 7
 use Symfony\Component\HttpFoundation\Request;
9
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
10 8
 
11 9
 class SimpleEditCounterController extends Controller
12 10
 {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
         $username = $request->query->get('user');
32 32
 
33 33
         if ($projectQuery != "" && $username != "") {
34
-            $routeParams = [ 'project'=>$projectQuery, 'username' => $username ];
34
+            $routeParams = ['project'=>$projectQuery, 'username' => $username];
35 35
             return $this->redirectToRoute("SimpleEditCounterResult", $routeParams);
36 36
         } elseif ($projectQuery != "") {
37
-            return $this->redirectToRoute("SimpleEditCounterProject", [ 'project'=>$projectQuery ]);
37
+            return $this->redirectToRoute("SimpleEditCounterProject", ['project'=>$projectQuery]);
38 38
         }
39 39
 
40 40
         // Otherwise fall through.
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
         $resultQuery->execute();
90 90
 
91 91
         if ($resultQuery->errorCode() > 0) {
92
-            $this->addFlash("notice", [ "noresult", $username ]);
93
-            return $this->redirectToRoute("SimpleEditCounterProject", [ "project"=>$project ]);
92
+            $this->addFlash("notice", ["noresult", $username]);
93
+            return $this->redirectToRoute("SimpleEditCounterProject", ["project"=>$project]);
94 94
         }
95 95
 
96 96
         // Fetch the result data
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
                 $rev = $row["value"];
115 115
             }
116 116
             if ($row["source"] == "groups") {
117
-                $groups .= $row["value"]. ", ";
117
+                $groups .= $row["value"].", ";
118 118
             }
119 119
         }
120 120
 
121 121
         // Unknown user - If the user is created the $results variable will have 3 entries.
122 122
         // This is a workaround to detect non-existent IPs.
123 123
         if (count($results) < 3 && $arch == 0 && $rev == 0) {
124
-            $this->addFlash('notice', [ "noresult", $username ]);
124
+            $this->addFlash('notice', ["noresult", $username]);
125 125
 
126
-            return $this->redirectToRoute("SimpleEditCounterProject", [ "project"=>$project ]);
126
+            return $this->redirectToRoute("SimpleEditCounterProject", ["project"=>$project]);
127 127
         }
128 128
 
129 129
         // Remove the last comma and space
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             'project_url' => $url,
153 153
             'id' => $id,
154 154
             'arch' => $arch,
155
-            'rev' => $rev + $arch,
155
+            'rev' => $rev+$arch,
156 156
             'live' => $rev,
157 157
             'groups' => $groups,
158 158
             'globalGroups' => $globalGroups,
Please login to merge, or discard this patch.
src/AppBundle/Helper/ApiHelper.php 2 patches
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@  discard block
 block discarded – undo
37 37
         }
38 38
     }
39 39
 
40
+    /**
41
+     * @param string $username
42
+     */
40 43
     public function groups($project, $username)
41 44
     {
42 45
 
@@ -57,6 +60,9 @@  discard block
 block discarded – undo
57 60
         return $result;
58 61
     }
59 62
 
63
+    /**
64
+     * @param string $username
65
+     */
60 66
     public function globalGroups($project, $username)
61 67
     {
62 68
 
@@ -348,7 +354,7 @@  discard block
 block discarded – undo
348 354
      * Adapted from https://github.com/MusikAnimal/pageviews
349 355
      * @param  array       $params        Associative array of params to pass to API
350 356
      * @param  string      $project       Project to query, e.g. en.wikipedia.org
351
-     * @param  string|func $dataKey       The key for the main chunk of data, in the query hash
357
+     * @param  \Closure $dataKey       The key for the main chunk of data, in the query hash
352 358
      *                                    (e.g. 'categorymembers' for API:Categorymembers).
353 359
      *                                    If this is a function it is given the response data,
354 360
      *                                    and expected to return the data we want to concatentate.
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
 
43 43
         $this->setUp($project);
44
-        $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ];
44
+        $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"];
45 45
         $query = new SimpleRequest('query', $params);
46 46
         $result = [];
47 47
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
 
63 63
         $this->setUp($project);
64
-        $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ];
64
+        $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"];
65 65
         $query = new SimpleRequest('query', $params);
66 66
         $result = [];
67 67
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
     public function namespaces($project)
87 87
     {
88 88
         // Use cache if possible.
89
-        $cacheItem = $this->cache->getItem('api.namespaces.' . $project);
89
+        $cacheItem = $this->cache->getItem('api.namespaces.'.$project);
90 90
         if ($cacheItem->isHit()) {
91 91
             return $cacheItem->get();
92 92
         }
93 93
 
94 94
         $this->setUp($project);
95
-        $query = new SimpleRequest('query', [ "meta"=>"siteinfo", "siprop"=>"namespaces" ]);
95
+        $query = new SimpleRequest('query', ["meta"=>"siteinfo", "siprop"=>"namespaces"]);
96 96
         $result = [];
97 97
 
98 98
         try {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             $normalized = [];
198 198
             if (isset($result['query']['normalized'])) {
199 199
                 array_map(
200
-                    function ($e) use (&$normalized) {
200
+                    function($e) use (&$normalized) {
201 201
                         $normalized[$e['to']] = $e['from'];
202 202
                     },
203 203
                     $result['query']['normalized']
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         ];
241 241
 
242 242
         // get assessments for this page from the API
243
-        $assessments = $this->massApi($params, $project, function ($data) {
243
+        $assessments = $this->massApi($params, $project, function($data) {
244 244
             return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : [];
245 245
         }, 'pacontinue')['pages'];
246 246
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                 $assessment['class']['value'] = '???';
269 269
                 // $1 is used to substitute the WikiProject name, e.g. Category:FA-Class Wikipedia 1.0 articles
270 270
                 $assessment['class']['category'] = str_replace('$1', $wikiproject, $classAttrs['category']);
271
-                $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge'];
271
+                $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge'];
272 272
             } else {
273 273
                 $classAttrs = $config['class'][$classValue];
274 274
                 $assessment['class'] = [
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
                 // add full URL to badge icon
281 281
                 if ($classAttrs['badge'] !== '') {
282
-                    $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" .
282
+                    $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".
283 283
                         $classAttrs['badge'];
284 284
                 }
285 285
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         $query = FluentRequest::factory()->setAction('query')->setParams($requestData);
406 406
         $innerPromise = $this->api->getRequestAsync($query);
407 407
 
408
-        $innerPromise->then(function ($result) use (&$data) {
408
+        $innerPromise->then(function($result) use (&$data) {
409 409
             // some failures come back as 200s, so we still resolve and let the outer function handle it
410 410
             if (isset($result['error']) || !isset($result['query'])) {
411 411
                 return $data['promise']->resolve($data);
Please login to merge, or discard this patch.
src/AppBundle/Helper/LabsHelper.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -25,6 +25,9 @@
 block discarded – undo
25 25
         $this->container = $container;
26 26
     }
27 27
 
28
+    /**
29
+     * @param string $tool
30
+     */
28 31
     public function checkEnabled($tool)
29 32
     {
30 33
         if (!$this->container->getParameter("enable.$tool")) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             // Create the query we're going to run against the meta database
62 62
             $wikiQuery = $this->client->createQueryBuilder();
63 63
             $wikiQuery
64
-                ->select([ 'dbName', 'name', 'url' ])
64
+                ->select(['dbName', 'name', 'url'])
65 65
                 ->from('wiki')
66 66
                 ->where($wikiQuery->expr()->eq('dbname', ':project'))
67 67
                 // The meta database will have the project's URL stored as https://en.wikipedia.org
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $this->dbName = $dbName;
100 100
         $this->url = $url;
101 101
 
102
-        return [ 'dbName' => $dbName, 'wikiName' => $wikiName, 'url' => $url ];
102
+        return ['dbName' => $dbName, 'wikiName' => $wikiName, 'url' => $url];
103 103
     }
104 104
 
105 105
     /**
Please login to merge, or discard this patch.
src/AppBundle/Twig/WikiExtension.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
     /**
158 158
      * Get links to pageviews tools for the given page
159 159
      * @param  string $title      Title of page
160
-     * @param  string $projectUrl Project domain such as en.wikipedia.org
160
+     * @param  string $project Project domain such as en.wikipedia.org
161 161
      * @return string Markup
162 162
      */
163 163
     public function pageviewsLinks($title, $project)
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,22 +14,22 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function intuitionMessage($message = "", $vars = [])
16 16
     {
17
-        return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]);
17
+        return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]);
18 18
     }
19 19
 
20 20
     /*********************************** FUNCTIONS ***********************************/
21 21
 
22 22
     public function getFunctions()
23 23
     {
24
-        $options = [ 'is_safe' => [ 'html']];
24
+        $options = ['is_safe' => ['html']];
25 25
         return [
26
-            new Twig_SimpleFunction('wiki_link', [ $this, 'wikiLink' ], $options),
27
-            new Twig_SimpleFunction('user_link', [ $this, 'userLink' ], $options),
28
-            new Twig_SimpleFunction('wiki_history_link', [ $this, 'wikiHistoryLink' ], $options),
29
-            new Twig_SimpleFunction('wiki_log_link', [ $this, 'wikiLogLink' ], $options),
30
-            new Twig_SimpleFunction('pageviews_links', [ $this, 'pageviewsLinks' ], $options),
31
-            new Twig_SimpleFunction('diff_link', [ $this, 'diffLink' ], $options),
32
-            new Twig_SimpleFunction('perma_link', [ $this, 'permaLink' ], $options),
26
+            new Twig_SimpleFunction('wiki_link', [$this, 'wikiLink'], $options),
27
+            new Twig_SimpleFunction('user_link', [$this, 'userLink'], $options),
28
+            new Twig_SimpleFunction('wiki_history_link', [$this, 'wikiHistoryLink'], $options),
29
+            new Twig_SimpleFunction('wiki_log_link', [$this, 'wikiLogLink'], $options),
30
+            new Twig_SimpleFunction('pageviews_links', [$this, 'pageviewsLinks'], $options),
31
+            new Twig_SimpleFunction('diff_link', [$this, 'diffLink'], $options),
32
+            new Twig_SimpleFunction('perma_link', [$this, 'permaLink'], $options),
33 33
         ];
34 34
     }
35 35
 
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
     public function getFilters()
181 181
     {
182 182
         return [
183
-            new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]),
184
-            new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]),
185
-            new \Twig_SimpleFilter('wikify_comment', [ $this, 'wikifyComment' ], [ 'is_safe' => [ 'html' ] ]),
183
+            new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']),
184
+            new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]),
185
+            new \Twig_SimpleFilter('wikify_comment', [$this, 'wikifyComment'], ['is_safe' => ['html']]),
186 186
         ];
187 187
     }
188 188
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
         if (!$denominator) {
219 219
             $quotient = 0;
220 220
         } else {
221
-            $quotient = ( $numerator / $denominator ) * 100;
221
+            $quotient = ($numerator / $denominator) * 100;
222 222
         }
223 223
 
224
-        return round($quotient, $precision) . '%';
224
+        return round($quotient, $precision).'%';
225 225
     }
226 226
 
227 227
     /**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         if ($isSection) {
240 240
             $sectionTitle = $sectionMatch[1][0];
241 241
             $sectionTitleLink = str_replace(' ', '_', $sectionTitle);
242
-            $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>&rarr;</a>" .
242
+            $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>&rarr;</a>".
243 243
                 "<em class='text-muted'>$sectionTitle:</em> ";
244 244
             $wikitext = str_replace($sectionMatch[0][0], $sectionWikitext, $wikitext);
245 245
         }
Please login to merge, or discard this patch.
var/SymfonyRequirements.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      * Adds a mandatory requirement in form of a php.ini configuration.
224 224
      *
225 225
      * @param string        $cfgName           The configuration name used for ini_get()
226
-     * @param bool|callback $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
226
+     * @param boolean|string $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
227 227
      *                                         or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
228 228
      * @param bool          $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
229 229
      *                                         This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      * Adds an optional recommendation in form of a php.ini configuration.
242 242
      *
243 243
      * @param string        $cfgName           The configuration name used for ini_get()
244
-     * @param bool|callback $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
244
+     * @param string|false $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
245 245
      *                                         or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
246 246
      * @param bool          $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
247 247
      *                                         This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
51 51
     {
52
-        $this->fulfilled = (bool) $fulfilled;
53
-        $this->testMessage = (string) $testMessage;
54
-        $this->helpHtml = (string) $helpHtml;
55
-        $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
56
-        $this->optional = (bool) $optional;
52
+        $this->fulfilled = (bool)$fulfilled;
53
+        $this->testMessage = (string)$testMessage;
54
+        $this->helpHtml = (string)$helpHtml;
55
+        $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string)$helpText;
56
+        $this->optional = (bool)$optional;
57 57
     }
58 58
 
59 59
     /**
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
             );
545 545
         }
546 546
 
547
-        $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
547
+        $pcreVersion = defined('PCRE_VERSION') ? (float)PCRE_VERSION : null;
548 548
 
549 549
         $this->addRequirement(
550 550
             null !== $pcreVersion,
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
         $unit = '';
784 784
         if (!ctype_digit($size)) {
785 785
             $unit = strtolower(substr($size, -1, 1));
786
-            $size = (int) substr($size, 0, -1);
786
+            $size = (int)substr($size, 0, -1);
787 787
         }
788 788
         switch ($unit) {
789 789
             case 'g':
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
             case 'k':
794 794
                 return $size * 1024;
795 795
             default:
796
-                return (int) $size;
796
+                return (int)$size;
797 797
         }
798 798
     }
799 799
 
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
                 continue;
816 816
             }
817 817
 
818
-            return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
818
+            return (int)$package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
819 819
         }
820 820
 
821 821
         return false;
Please login to merge, or discard this patch.