@@ -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; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @Route("/rfxvote", name="rfxvote") |
| 38 | 38 | * @Route("/rfxvote", name="RfXVoteCalculator") |
| 39 | 39 | * |
| 40 | - * @return Response |
|
| 40 | + * @return \Symfony\Component\HttpFoundation\Response |
|
| 41 | 41 | */ |
| 42 | 42 | public function indexAction() |
| 43 | 43 | { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @Route("/rfxvote/{project}/{username}", name="rfxvoteResult") |
| 88 | 88 | * |
| 89 | - * @return Response |
|
| 89 | + * @return \Symfony\Component\HttpFoundation\Response |
|
| 90 | 90 | */ |
| 91 | 91 | public function resultAction($project, $username) |
| 92 | 92 | { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $username = $request->query->get('username'); |
| 49 | 49 | |
| 50 | 50 | if ($projectQuery != '' && $username != '') { |
| 51 | - $routeParams = [ 'project' => $projectQuery, 'username' => $username ]; |
|
| 51 | + $routeParams = ['project' => $projectQuery, 'username' => $username]; |
|
| 52 | 52 | return $this->redirectToRoute( |
| 53 | 53 | 'rfxvoteResult', |
| 54 | 54 | $routeParams |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | $titles = []; |
| 168 | 168 | |
| 169 | 169 | while ($row = $sth->fetch()) { |
| 170 | - $titles[] = $namespaces[$row['page_namespace']] . |
|
| 171 | - ':' .$row['page_title']; |
|
| 170 | + $titles[] = $namespaces[$row['page_namespace']]. |
|
| 171 | + ':'.$row['page_title']; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Chunking... it's possible to make a URI too long |
@@ -8,7 +8,6 @@ |
||
| 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; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @Route("/rfx/{project}", name="rfxAnalysisProject") |
| 45 | 45 | * @Route("/rfx/{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 | { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @Route("/rfx/{project}/{type}/{username}", name="rfxAnalysisResult") |
| 112 | 112 | * |
| 113 | - * @return Response|RedirectResponse |
|
| 113 | + * @return \Symfony\Component\HttpFoundation\Response |
|
| 114 | 114 | */ |
| 115 | 115 | public function resultAction($project, $type, $username) |
| 116 | 116 | { |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | $neutral = $rfx->getSection('neutral'); |
| 167 | 167 | $dup = $rfx->getDuplicates(); |
| 168 | 168 | |
| 169 | - $total = count($support) + count($oppose) + count($neutral); |
|
| 169 | + $total = count($support)+count($oppose)+count($neutral); |
|
| 170 | 170 | |
| 171 | 171 | if ($total === 0) { |
| 172 | 172 | $this->addFlash('notice', ['no-result', $pagename]); |
@@ -66,7 +66,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -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 | } |