Completed
Pull Request — master (#67)
by MusikAnimal
03:02
created
src/AppBundle/Controller/RfXVoteCalculatorController.php 3 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.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @Route("/rfap", name="rfap")
50 50
      * @Route("/rfap", name="RfXVoteCalculator")
51 51
      *
52
-     * @return Response
52
+     * @return \Symfony\Component\HttpFoundation\Response
53 53
      */
54 54
     public function indexAction()
55 55
     {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @Route("/rfap/{project}/{username}", name="rfapResult")
92 92
      *
93
-     * @return Response
93
+     * @return \Symfony\Component\HttpFoundation\Response
94 94
      */
95 95
     public function resultAction($project, $username)
96 96
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $username = $request->query->get('username');
61 61
 
62 62
         if ($projectQuery != '' && $username != '') {
63
-            $routeParams = [ 'project' => $projectQuery, 'username' => $username ];
63
+            $routeParams = ['project' => $projectQuery, 'username' => $username];
64 64
             return $this->redirectToRoute(
65 65
                 'rfapResult',
66 66
                 $routeParams
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
             $titles = [];
180 180
 
181 181
             while ($row = $sth->fetch()) {
182
-                $titles[] = $namespaces[$row['page_namespace']] .
183
-                    ':' .$row['page_title'];
182
+                $titles[] = $namespaces[$row['page_namespace']].
183
+                    ':'.$row['page_title'];
184 184
             }
185 185
 
186 186
             // Chunking... it's possible to make a URI too long
Please login to merge, or discard this patch.
src/Xtools/RFA.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * Returns matches.
36 36
      *
37 37
      * @param string $input   The line we're looking for
38
-     * @param array  $matches Pointer to an array where we stash results
38
+     * @param string[]  $matches Pointer to an array where we stash results
39 39
      *
40 40
      * @TODO: Make this cleaner
41 41
      *
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             }
120 120
         }
121 121
 
122
-        $final = [];    // initialize the final array
122
+        $final = []; // initialize the final array
123 123
         $finalRaw = []; // Initialize the raw data array
124 124
 
125 125
         foreach ($this->data as $key => $value) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         $final = array_count_values($final); // find repetition and its count
134 134
 
135
-        $final = array_diff($final, [1]);    // remove single occurrences
135
+        $final = array_diff($final, [1]); // remove single occurrences
136 136
 
137 137
         $this->duplicates = array_keys($final);
138 138
     }
Please login to merge, or discard this patch.
src/AppBundle/Helper/ApiHelper.php 1 patch
Spacing   +7 added lines, -7 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);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
         $titleText = join("|", $titles);
367 367
 
368
-        $params= [
368
+        $params = [
369 369
             "titles" => $titleText,
370 370
             "prop" => "revisions",
371 371
             "rvprop" =>"content"
Please login to merge, or discard this patch.
src/AppBundle/Controller/RfXAnalysisController.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @Route("/rfa/{project}",        name="rfxAnalysisProject")
45 45
      * @Route("/rfa/{project}/{type}", name="rfxAnalysisProjectType")
46 46
      *
47
-     * @return Response|RedirectResponse
47
+     * @return \Symfony\Component\HttpFoundation\Response
48 48
      */
49 49
     public function indexAction(Request $request, $project = null, $type = null)
50 50
     {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @Route("/rfa/{project}/{type}/{username}", name="rfxAnalysisResult")
111 111
      *
112
-     * @return Response|RedirectResponse
112
+     * @return \Symfony\Component\HttpFoundation\Response
113 113
      */
114 114
     public function resultAction($project, $type, $username)
115 115
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9 9
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10 10
 use Symfony\Component\HttpFoundation\Request;
11
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
12 11
 use Xtools\ProjectRepository;
13 12
 use Xtools\Page;
14 13
 use Xtools\PagesRepository;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@
 block discarded – undo
167 167
         $neutral = $rfa->getSection("neutral");
168 168
         $dup = $rfa->getDuplicates();
169 169
 
170
-        if ((sizeof($support) + sizeof($oppose) + sizeof($neutral)) == 0) {
170
+        if ((sizeof($support)+sizeof($oppose)+sizeof($neutral)) == 0) {
171 171
             $this->addFlash("notice", ["no-result", $pagename]);
172 172
             return $this->redirectToRoute(
173 173
                 "rfxAnalysisProject",
Please login to merge, or discard this patch.
src/Xtools/Page.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $info = $this->getPageInfo();
67 67
         $title = isset($info['title']) ? $info['title'] : $this->unnormalizedPageName;
68 68
         $nsName = $this->getNamespaceName();
69
-        return str_replace($nsName . ':', '', $title);
69
+        return str_replace($nsName.':', '', $title);
70 70
     }
71 71
 
72 72
     /**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
         // Otherwise do a COUNT in the event fetching
209 209
         // all revisions is not desired
210
-        return (int) $this->getRepository()->getNumRevisions($this, $user);
210
+        return (int)$this->getRepository()->getNumRevisions($this, $user);
211 211
     }
212 212
 
213 213
     /**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $content = $this->getRepository()->getPagesWikitext(
236 236
             $this->getProject(),
237
-            [ $this->getTitle() ]
237
+            [$this->getTitle()]
238 238
         );
239 239
 
240 240
         return isset($content[$this->getTitle()])
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
         $wikidataInfo = $this->getRepository()->getWikidataInfo($this);
383 383
 
384
-        $terms = array_map(function ($entry) {
384
+        $terms = array_map(function($entry) {
385 385
             return $entry['term'];
386 386
         }, $wikidataInfo);
387 387
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                 'prio' => 2,
393 393
                 'name' => 'Wikidata',
394 394
                 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n
395
-                'explanation' => "See: <a target='_blank' " .
395
+                'explanation' => "See: <a target='_blank' ".
396 396
                     "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>",
397 397
             ];
398 398
         }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
                 'prio' => 3,
403 403
                 'name' => 'Wikidata',
404 404
                 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n
405
-                'explanation' => "See: <a target='_blank' " .
405
+                'explanation' => "See: <a target='_blank' ".
406 406
                     "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>",
407 407
             ];
408 408
         }
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
             return 0;
474 474
         }
475 475
 
476
-        return array_sum(array_map(function ($item) {
477
-            return (int) $item['views'];
476
+        return array_sum(array_map(function($item) {
477
+            return (int)$item['views'];
478 478
         }, $pageviews['items']));
479 479
     }
480 480
 
Please login to merge, or discard this patch.