Completed
Pull Request — master (#67)
by Matthew
02:54
created
src/AppBundle/Controller/RfXAnalysisController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
15 15
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
16 16
 use Symfony\Component\HttpFoundation\Request;
17
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
18 17
 use Xtools\ProjectRepository;
19 18
 use Xtools\RFA;
20 19
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         $neutral = $rfa->getSection("neutral");
171 171
         $dup = $rfa->getDuplicates();
172 172
 
173
-        if ((sizeof($support) + sizeof($oppose) + sizeof($neutral)) == 0) {
173
+        if ((sizeof($support)+sizeof($oppose)+sizeof($neutral)) == 0) {
174 174
             $this->addFlash("notice", ["no-result", $pagename]);
175 175
             return $this->redirectToRoute(
176 176
                 "rfxAnalysisProject",
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         $end = $rfa->getEndDate();
184 184
 
185 185
         $percent = (sizeof($support) /
186
-            (sizeof($support) + sizeof($oppose) + sizeof($neutral)));
186
+            (sizeof($support)+sizeof($oppose)+sizeof($neutral)));
187 187
 
188 188
         $percent = $percent * 100;
189 189
 
Please login to merge, or discard this patch.
src/AppBundle/Controller/RfXVoteCalculatorController.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,6 @@
 block discarded – undo
3 3
 namespace AppBundle\Controller;
4 4
 
5 5
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
-use Symfony\Component\CssSelector\Exception\InternalErrorException;
7
-use Symfony\Component\Debug\Exception\ContextErrorException;
8 6
 use Symfony\Component\HttpFoundation\Request;
9 7
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
10 8
 use Xtools\ProjectRepository;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         $username = $request->query->get('username');
42 42
 
43 43
         if ($projectQuery != "" && $username != "") {
44
-            $routeParams = [ 'project'=>$projectQuery, 'username' => $username ];
44
+            $routeParams = ['project'=>$projectQuery, 'username' => $username];
45 45
             return $this->redirectToRoute(
46 46
                 "rfapResult",
47 47
                 $routeParams
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
             $titles = [];
136 136
 
137 137
             while ($row = $sth->fetch()) {
138
-                $titles[] = $namespaces[$row["page_namespace"]] .
139
-                    ":" .$row["page_title"];
138
+                $titles[] = $namespaces[$row["page_namespace"]].
139
+                    ":".$row["page_title"];
140 140
             }
141 141
 
142 142
             // Chunking... it's possible to make a URI too long
Please login to merge, or discard this patch.
src/Xtools/RFA.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      * Returns matches.
21 21
      *
22 22
      * @param $input
23
-     * @param $matches
23
+     * @param string[] $matches
24 24
      *
25 25
      * @return int
26 26
      */
@@ -85,6 +85,9 @@  discard block
 block discarded – undo
85 85
         return $this->userSectionFound;
86 86
     }
87 87
 
88
+    /**
89
+     * @param string $sectionName
90
+     */
88 91
     public function getSection($sectionName) {
89 92
         $sectionName = strtolower($sectionName);
90 93
         if (!isset($this->data[$sectionName])) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,7 @@
 block discarded – undo
89 89
         $sectionName = strtolower($sectionName);
90 90
         if (!isset($this->data[$sectionName])) {
91 91
             return [];
92
-        }
93
-        else {
92
+        } else {
94 93
             return $this->data[$sectionName];
95 94
         }
96 95
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @return int
27 27
      */
28
-    protected function findSig( $input, &$matches ) {
28
+    protected function findSig($input, &$matches) {
29 29
         //Supports User: and User talk: wikilinks, {{fullurl}}, unsubsted {{unsigned}}, unsubsted {{unsigned2}}, anything that looks like a custom sig template
30 30
         // TODO: Cross-wiki this sucker
31 31
         return preg_match_all(
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             }
81 81
         }
82 82
 
83
-        $final = [];    // initialize the final array
83
+        $final = []; // initialize the final array
84 84
         $finalRaw = []; // Initialize the raw data array
85 85
 
86 86
         foreach ($this->data as $key => $value) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         $final = array_count_values($final); // find repetition and its count
95 95
 
96
-        $final = array_diff($final, [1]);    // remove single occurrences
96
+        $final = array_diff($final, [1]); // remove single occurrences
97 97
 
98 98
         $this->duplicates = array_keys($final);
99 99
 
Please login to merge, or discard this patch.
src/AppBundle/Twig/AppExtension.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -489,7 +489,9 @@
 block discarded – undo
489 489
      */
490 490
     public function quote()
491 491
     {
492
-        if (!$this->container->getParameter("enable.bash")) return "";
492
+        if (!$this->container->getParameter("enable.bash")) {
493
+            return "";
494
+        }
493 495
         $quotes = $this->container->getParameter('quotes');
494 496
         $id = array_rand($quotes);
495 497
         return $quotes[$id];
Please login to merge, or discard this patch.
src/AppBundle/Helper/ApiHelper.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     public function groups($project, $username)
61 61
     {
62 62
         $this->setUp($project);
63
-        $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ];
63
+        $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"];
64 64
         $query = new SimpleRequest('query', $params);
65 65
         $result = [];
66 66
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function globalGroups($project, $username)
89 89
     {
90 90
         $this->setUp($project);
91
-        $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ];
91
+        $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"];
92 92
         $query = new SimpleRequest('query', $params);
93 93
         $result = [];
94 94
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 $groups[] = "B";
139 139
             }
140 140
             if (in_array("steward", $admin["groups"])) {
141
-                $groups[] = "S" ;
141
+                $groups[] = "S";
142 142
             }
143 143
             if (in_array("checkuser", $admin["groups"])) {
144 144
                 $groups[] = "CU";
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             if (in_array("bot", $admin["groups"])) {
150 150
                 $groups[] = "Bot";
151 151
             }
152
-            $result[ $admin["name"] ] = [
152
+            $result[$admin["name"]] = [
153 153
                 "groups" => implode('/', $groups)
154 154
             ];
155 155
         }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             $normalized = [];
183 183
             if (isset($result['query']['normalized'])) {
184 184
                 array_map(
185
-                    function ($e) use (&$normalized) {
185
+                    function($e) use (&$normalized) {
186 186
                         $normalized[$e['to']] = $e['from'];
187 187
                     },
188 188
                     $result['query']['normalized']
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $query = FluentRequest::factory()->setAction('query')->setParams($requestData);
268 268
         $innerPromise = $this->api->getRequestAsync($query);
269 269
 
270
-        $innerPromise->then(function ($result) use (&$data) {
270
+        $innerPromise->then(function($result) use (&$data) {
271 271
             // some failures come back as 200s, so we still resolve and let the outer function handle it
272 272
             if (isset($result['error']) || !isset($result['query'])) {
273 273
                 return $data['promise']->resolve($data);
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
         $titleText = join("|", $titles);
349 349
 
350
-        $params= [
350
+        $params = [
351 351
             "titles" => $titleText,
352 352
             "prop" => "revisions",
353 353
             "rvprop" =>"content"
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
             if (!isset($res["query"]["pages"])) {
361 361
                 return [];
362 362
             }
363
-            foreach($res["query"]["pages"] as $key => $value) {
364
-                if(isset($value["revisions"][0]["*"])) {
363
+            foreach ($res["query"]["pages"] as $key => $value) {
364
+                if (isset($value["revisions"][0]["*"])) {
365 365
                     $result[$value["title"]] = $value["revisions"][0]["*"];
366 366
                 }
367 367
                 else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -363,8 +363,7 @@
 block discarded – undo
363 363
             foreach($res["query"]["pages"] as $key => $value) {
364 364
                 if(isset($value["revisions"][0]["*"])) {
365 365
                     $result[$value["title"]] = $value["revisions"][0]["*"];
366
-                }
367
-                else {
366
+                } else {
368 367
                     $result[$value["title"]] = "";
369 368
                 }
370 369
             }
Please login to merge, or discard this patch.
src/Xtools/ProjectRepository.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -208,8 +208,7 @@
 block discarded – undo
208 208
 
209 209
         try {
210 210
             $api = MediawikiApi::newFromPage($projectUrl);
211
-        }
212
-        catch (\Exception $e) {
211
+        } catch (\Exception $e) {
213 212
             return null;
214 213
         }
215 214
 
Please login to merge, or discard this patch.