Completed
Pull Request — master (#13)
by
unknown
02:25
created
src/AppBundle/Twig/WikiExtension.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,6 @@  discard block
 block discarded – undo
72 72
 
73 73
     /**
74 74
      * Get a link to the given user's userpage, or to Special:Contribs if $username is an IP
75
-     * @param  string $username   Username
76 75
      * @param  string $projectUrl Project domain and protocol such as https://en.wikipedia.org
77 76
      * @param  string [$label]    The link text, defaults to $username
78 77
      * @return string Markup
@@ -176,7 +175,7 @@  discard block
 block discarded – undo
176 175
     /**
177 176
      * Get links to pageviews tools for the given page
178 177
      * @param  string $title      Title of page
179
-     * @param  string $projectUrl Project domain such as en.wikipedia.org
178
+     * @param  string $project Project domain such as en.wikipedia.org
180 179
      * @return string Markup
181 180
      */
182 181
     public function pageviewsLinks($title, $project)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  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('group_link', [ $this, 'groupLink' ], $options),
29
-            new Twig_SimpleFunction('wiki_history_link', [ $this, 'wikiHistoryLink' ], $options),
30
-            new Twig_SimpleFunction('wiki_log_link', [ $this, 'wikiLogLink' ], $options),
31
-            new Twig_SimpleFunction('pageviews_links', [ $this, 'pageviewsLinks' ], $options),
32
-            new Twig_SimpleFunction('diff_link', [ $this, 'diffLink' ], $options),
33
-            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('group_link', [$this, 'groupLink'], $options),
29
+            new Twig_SimpleFunction('wiki_history_link', [$this, 'wikiHistoryLink'], $options),
30
+            new Twig_SimpleFunction('wiki_log_link', [$this, 'wikiLogLink'], $options),
31
+            new Twig_SimpleFunction('pageviews_links', [$this, 'pageviewsLinks'], $options),
32
+            new Twig_SimpleFunction('diff_link', [$this, 'diffLink'], $options),
33
+            new Twig_SimpleFunction('perma_link', [$this, 'permaLink'], $options),
34 34
         ];
35 35
     }
36 36
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
     public function getFilters()
200 200
     {
201 201
         return [
202
-            new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]),
203
-            new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]),
204
-            new \Twig_SimpleFilter('wikify_comment', [ $this, 'wikifyComment' ], [ 'is_safe' => [ 'html' ] ]),
202
+            new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']),
203
+            new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]),
204
+            new \Twig_SimpleFilter('wikify_comment', [$this, 'wikifyComment'], ['is_safe' => ['html']]),
205 205
         ];
206 206
     }
207 207
 
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
         if (!$denominator) {
238 238
             $quotient = 0;
239 239
         } else {
240
-            $quotient = ( $numerator / $denominator ) * 100;
240
+            $quotient = ($numerator / $denominator) * 100;
241 241
         }
242 242
 
243
-        return round($quotient, $precision) . '%';
243
+        return round($quotient, $precision).'%';
244 244
     }
245 245
 
246 246
     /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         if ($isSection) {
259 259
             $sectionTitle = $sectionMatch[1][0];
260 260
             $sectionTitleLink = str_replace(' ', '_', $sectionTitle);
261
-            $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>&rarr;</a>" .
261
+            $sectionWikitext = "<a target='_blank' href='$projectUrl/wiki/$title#$sectionTitleLink'>&rarr;</a>".
262 262
                 "<em class='text-muted'>$sectionTitle:</em> ";
263 263
             $wikitext = str_replace($sectionMatch[0][0], $sectionWikitext, $wikitext);
264 264
         }
Please login to merge, or discard this patch.
src/AppBundle/Controller/AdminStatsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         // Iterate over query results, loading each user id into the array
178 178
         while ($row = $res->fetch()) {
179
-            $adminIdArr[] = $row["user_id"] ;
179
+            $adminIdArr[] = $row["user_id"];
180 180
         }
181 181
 
182 182
         // Set the query results to be useful in a sql statement.
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         }
231 231
 
232 232
         if ($adminCount > 0) {
233
-            $adminsWithoutActionPct = $adminsWithoutAction/$adminCount;
233
+            $adminsWithoutActionPct = $adminsWithoutAction / $adminCount;
234 234
         }
235 235
 
236 236
         // Pull the admins from the API, for merging.
Please login to merge, or discard this patch.
src/AppBundle/Helper/ApiHelper.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -52,6 +52,9 @@  discard block
 block discarded – undo
52 52
         }
53 53
     }
54 54
 
55
+    /**
56
+     * @param string $username
57
+     */
55 58
     public function groups($project, $username)
56 59
     {
57 60
 
@@ -72,6 +75,9 @@  discard block
 block discarded – undo
72 75
         return $result;
73 76
     }
74 77
 
78
+    /**
79
+     * @param string $username
80
+     */
75 81
     public function globalGroups($project, $username)
76 82
     {
77 83
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
 
58 58
         $this->setUp($project);
59
-        $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ];
59
+        $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"];
60 60
         $query = new SimpleRequest('query', $params);
61 61
         $result = [];
62 62
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
 
78 78
         $this->setUp($project);
79
-        $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ];
79
+        $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"];
80 80
         $query = new SimpleRequest('query', $params);
81 81
         $result = [];
82 82
 
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
     public function namespaces($project)
102 102
     {
103 103
         // Use cache if possible.
104
-        $cacheItem = $this->cache->getItem('api.namespaces.' . $project);
104
+        $cacheItem = $this->cache->getItem('api.namespaces.'.$project);
105 105
         if ($cacheItem->isHit()) {
106 106
             return $cacheItem->get();
107 107
         }
108 108
 
109 109
         $this->setUp($project);
110
-        $query = new SimpleRequest('query', [ "meta"=>"siteinfo", "siprop"=>"namespaces" ]);
110
+        $query = new SimpleRequest('query', ["meta"=>"siteinfo", "siprop"=>"namespaces"]);
111 111
         $result = [];
112 112
 
113 113
         try {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                 $groups[] = "B";
167 167
             }
168 168
             if (in_array("steward", $admin["groups"])) {
169
-                $groups[] = "S" ;
169
+                $groups[] = "S";
170 170
             }
171 171
             if (in_array("checkuser", $admin["groups"])) {
172 172
                 $groups[] = "CU";
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             if (in_array("bot", $admin["groups"])) {
178 178
                 $groups[] = "Bot";
179 179
             }
180
-            $result[ $admin["name"] ] = [
180
+            $result[$admin["name"]] = [
181 181
                 "editcount" => $admin["editcount"],
182 182
                 "groups" => implode('/', $groups)
183 183
             ];
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
             $normalized = [];
254 254
             if (isset($result['query']['normalized'])) {
255 255
                 array_map(
256
-                    function ($e) use (&$normalized) {
256
+                    function($e) use (&$normalized) {
257 257
                         $normalized[$e['to']] = $e['from'];
258 258
                     },
259 259
                     $result['query']['normalized']
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         ];
297 297
 
298 298
         // get assessments for this page from the API
299
-        $assessments = $this->massApi($params, $project, function ($data) {
299
+        $assessments = $this->massApi($params, $project, function($data) {
300 300
             return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : [];
301 301
         }, 'pacontinue')['pages'];
302 302
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                 $classAttrs = $config['class']['Unknown'];
324 324
                 $assessment['class']['value'] = '???';
325 325
                 $assessment['class']['category'] = $classAttrs['category'];
326
-                $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge'];
326
+                $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge'];
327 327
             } else {
328 328
                 $classAttrs = $config['class'][$classValue];
329 329
                 $assessment['class'] = [
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
                 // add full URL to badge icon
336 336
                 if ($classAttrs['badge'] !== '') {
337
-                    $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" .
337
+                    $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".
338 338
                         $classAttrs['badge'];
339 339
                 }
340 340
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         $query = FluentRequest::factory()->setAction('query')->setParams($requestData);
459 459
         $innerPromise = $this->api->getRequestAsync($query);
460 460
 
461
-        $innerPromise->then(function ($result) use (&$data) {
461
+        $innerPromise->then(function($result) use (&$data) {
462 462
             // some failures come back as 200s, so we still resolve and let the outer function handle it
463 463
             if (isset($result['error']) || !isset($result['query'])) {
464 464
                 return $data['promise']->resolve($data);
Please login to merge, or discard this patch.