@@ -14,7 +14,6 @@ |
||
| 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 | |
@@ -170,7 +170,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -3,8 +3,6 @@ |
||
| 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; |
@@ -41,7 +41,7 @@ discard block |
||
| 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 |
||
| 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 |
@@ -49,7 +49,7 @@ discard block |
||
| 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 |
||
| 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 | { |
@@ -35,7 +35,7 @@ |
||
| 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 | * |
@@ -119,7 +119,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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" |