@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return $this->editCounts[$domain]; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $this->editCounts[$domain] = (int) $this->getRepository()->getEditCount( |
|
| 95 | + $this->editCounts[$domain] = (int)$this->getRepository()->getEditCount( |
|
| 96 | 96 | $project->getDatabaseName(), |
| 97 | 97 | $this->getUsername() |
| 98 | 98 | ); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function isAnon() |
| 160 | 160 | { |
| 161 | - return (bool) filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 161 | + return (bool)filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function countEdits(Project $project, $namespace = 'all', $start = '', $end = '') |
| 222 | 222 | { |
| 223 | - return (int) $this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 223 | + return (int)$this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function countAutomatedEdits(Project $project, $namespace = 'all', $start = '', $end = '') |
| 235 | 235 | { |
| 236 | - return (int) $this->getRepository()->countAutomatedEdits($project, $this, $namespace, $start, $end); |
|
| 236 | + return (int)$this->getRepository()->countAutomatedEdits($project, $this, $namespace, $start, $end); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | $namespaces = $project->getNamespaces(); |
| 267 | 267 | |
| 268 | - return array_map(function ($rev) use ($namespaces) { |
|
| 268 | + return array_map(function($rev) use ($namespaces) { |
|
| 269 | 269 | $pageTitle = $rev['page_title']; |
| 270 | 270 | $fullPageTitle = ''; |
| 271 | 271 | |
| 272 | 272 | if ($rev['page_namespace'] !== '0') { |
| 273 | - $fullPageTitle = $namespaces[$rev['page_namespace']] . ":$pageTitle"; |
|
| 273 | + $fullPageTitle = $namespaces[$rev['page_namespace']].":$pageTitle"; |
|
| 274 | 274 | } else { |
| 275 | 275 | $fullPageTitle = $pageTitle; |
| 276 | 276 | } |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | return [ |
| 279 | 279 | 'full_page_title' => $fullPageTitle, |
| 280 | 280 | 'page_title' => $pageTitle, |
| 281 | - 'page_namespace' => (int) $rev['page_namespace'], |
|
| 282 | - 'rev_id' => (int) $rev['rev_id'], |
|
| 281 | + 'page_namespace' => (int)$rev['page_namespace'], |
|
| 282 | + 'rev_id' => (int)$rev['rev_id'], |
|
| 283 | 283 | 'timestamp' => DateTime::createFromFormat('YmdHis', $rev['timestamp']), |
| 284 | - 'minor' => (bool) $rev['minor'], |
|
| 285 | - 'length' => (int) $rev['length'], |
|
| 286 | - 'length_change' => (int) $rev['length_change'], |
|
| 284 | + 'minor' => (bool)$rev['minor'], |
|
| 285 | + 'length' => (int)$rev['length'], |
|
| 286 | + 'length_change' => (int)$rev['length_change'], |
|
| 287 | 287 | 'comment' => $rev['comment'], |
| 288 | 288 | ]; |
| 289 | 289 | }, $revs); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $end = $request->query->get('end'); |
| 32 | 32 | |
| 33 | 33 | if ($start != '' && $end != '') { |
| 34 | - return $this->redirectToRoute('MetaResult', [ 'start' => $start, 'end' => $end ]); |
|
| 34 | + return $this->redirectToRoute('MetaResult', ['start' => $start, 'end' => $end]); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | return $this->render('meta/index.html.twig', [ |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $timeline = []; |
| 74 | 74 | $startObj = new DateTime($start); |
| 75 | 75 | $endObj = new DateTime($end); |
| 76 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
| 76 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
| 77 | 77 | $grandSum = 0; |
| 78 | 78 | |
| 79 | 79 | // Generate array of date labels |
@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | foreach ($data as $entry) { |
| 85 | 85 | if (!isset($totals[$entry['tool']])) { |
| 86 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
| 86 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
| 87 | 87 | |
| 88 | 88 | // Create arrays for each tool, filled with zeros for each date in the timeline |
| 89 | 89 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
| 90 | 90 | } else { |
| 91 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
| 91 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $date = new DateTime($entry['date']); |
| 95 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
| 96 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
| 95 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
| 96 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
| 97 | 97 | |
| 98 | 98 | $grandSum += $entry['count']; |
| 99 | 99 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $conn = $this->container->get('doctrine')->getManager('default')->getConnection(); |
| 146 | - $date = date('Y-m-d'); |
|
| 146 | + $date = date('Y-m-d'); |
|
| 147 | 147 | |
| 148 | 148 | // Increment count in timeline |
| 149 | 149 | $existsSql = "SELECT 1 FROM usage_timeline |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | * @param Request $request The HTTP request. |
| 156 | 156 | * @param User $user The User. |
| 157 | 157 | * @param Project $project The project. |
| 158 | - * @param integer|string $namespace The namespace ID or 'all' |
|
| 158 | + * @param integer $namespace The namespace ID or 'all' |
|
| 159 | 159 | * @return \Symfony\Component\HttpFoundation\Response |
| 160 | 160 | */ |
| 161 | 161 | public function namespaceTopEdits(Request $request, User $user, Project $project, $namespace) |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | |
| 6 | 6 | namespace AppBundle\Controller; |
| 7 | 7 | |
| 8 | -use AppBundle\Helper\ApiHelper; |
|
| 9 | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 10 | 9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 11 | 10 | use Symfony\Component\HttpFoundation\RedirectResponse; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'xtSubtitle' => 'tool-topedits-desc', |
| 97 | 97 | 'xtPage' => 'topedits', |
| 98 | 98 | 'project' => $project, |
| 99 | - 'namespace' => (int) $namespace, |
|
| 99 | + 'namespace' => (int)$namespace, |
|
| 100 | 100 | 'article' => $article, |
| 101 | 101 | ]); |
| 102 | 102 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | // Send all to the template. |
| 249 | 249 | return $this->render('topedits/result_article.html.twig', [ |
| 250 | 250 | 'xtPage' => 'topedits', |
| 251 | - 'xtTitle' => $user->getUsername() . ' - ' . $page->getTitle(), |
|
| 251 | + 'xtTitle' => $user->getUsername().' - '.$page->getTitle(), |
|
| 252 | 252 | 'project' => $project, |
| 253 | 253 | 'user' => $user, |
| 254 | 254 | 'page' => $page, |
@@ -5,9 +5,6 @@ |
||
| 5 | 5 | |
| 6 | 6 | namespace Xtools; |
| 7 | 7 | |
| 8 | -use Symfony\Component\DependencyInjection\Container; |
|
| 9 | -use DateTime; |
|
| 10 | - |
|
| 11 | 8 | /** |
| 12 | 9 | * TopEdits returns the top-edited pages by a user. There is not a separate |
| 13 | 10 | * repository because there is only one query :) |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | $displayTitles = $this->getDisplayTitles($pages); |
| 120 | 120 | |
| 121 | 121 | foreach ($pages as $page) { |
| 122 | - $nsId = (int) $page['page_namespace']; |
|
| 123 | - $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']] . ':' : ''; |
|
| 124 | - $pageTitle = $nsTitle . $page['page_title']; |
|
| 122 | + $nsId = (int)$page['page_namespace']; |
|
| 123 | + $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']].':' : ''; |
|
| 124 | + $pageTitle = $nsTitle.$page['page_title']; |
|
| 125 | 125 | $page['displaytitle'] = $displayTitles[$pageTitle]; |
| 126 | 126 | |
| 127 | 127 | // $page['page_title'] is retained without the namespace |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | $namespaces = $this->project->getNamespaces(); |
| 149 | 149 | |
| 150 | 150 | // First extract page titles including namespace. |
| 151 | - $pageTitles = array_map(function ($page) use ($namespaces) { |
|
| 151 | + $pageTitles = array_map(function($page) use ($namespaces) { |
|
| 152 | 152 | // If non-mainspace, prepend namespace to the titles. |
| 153 | 153 | $ns = $page['page_namespace']; |
| 154 | - $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']] . ':' : ''; |
|
| 155 | - return $nsTitle . $page['page_title']; |
|
| 154 | + $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']].':' : ''; |
|
| 155 | + return $nsTitle.$page['page_title']; |
|
| 156 | 156 | }, $topPages); |
| 157 | 157 | |
| 158 | 158 | return $this->getRepository()->getDisplayTitles($this->project, $pageTitles); |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Symfony\Component\HttpFoundation\Response; |
| 13 | 13 | use Xtools\Project; |
| 14 | 14 | use Xtools\ProjectRepository; |
| 15 | -use Xtools\User; |
|
| 16 | 15 | use Xtools\UserRepository; |
| 17 | 16 | |
| 18 | 17 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | // If we've got a project and user, redirect to results. |
| 58 | 58 | if ($projectName != '' && $username != '') { |
| 59 | - $routeParams = [ 'project' => $projectName, 'username' => $username ]; |
|
| 59 | + $routeParams = ['project' => $projectName, 'username' => $username]; |
|
| 60 | 60 | return $this->redirectToRoute( |
| 61 | 61 | 'DeletionCounterResult', |
| 62 | 62 | $routeParams |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $types = $this->container->getParameter("deletion_counter"); |
| 128 | 128 | |
| 129 | 129 | if (!isset($types[$domain])) { |
| 130 | - $this->addFlash('notice', [ 'no-result', $username ]); |
|
| 130 | + $this->addFlash('notice', ['no-result', $username]); |
|
| 131 | 131 | return $this->redirectToRoute( |
| 132 | 132 | 'DeletionCounter', |
| 133 | 133 | [ |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $resultQuery->execute(); |
| 154 | 154 | |
| 155 | 155 | if ($resultQuery->errorCode() > 0) { |
| 156 | - $this->addFlash('notice', [ 'no-result', $username ]); |
|
| 156 | + $this->addFlash('notice', ['no-result', $username]); |
|
| 157 | 157 | return $this->redirectToRoute( |
| 158 | 158 | 'DeletionCounterProject', |
| 159 | 159 | [ |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $resultData = $resultQuery->fetchAll(); |
| 167 | 167 | |
| 168 | 168 | if (count($resultData) == 0) { |
| 169 | - $this->addFlash('notice', [ 'no-result', $username ]); |
|
| 169 | + $this->addFlash('notice', ['no-result', $username]); |
|
| 170 | 170 | return $this->redirectToRoute( |
| 171 | 171 | 'DeletionCounterProject', |
| 172 | 172 | [ |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // Unknown user or generated no results |
| 186 | 186 | // This is a workaround to detect non-existent IPs. |
| 187 | 187 | if (count($results) == 0) { |
| 188 | - $this->addFlash('notice', [ 'no-result', $username ]); |
|
| 188 | + $this->addFlash('notice', ['no-result', $username]); |
|
| 189 | 189 | |
| 190 | 190 | return $this->redirectToRoute( |
| 191 | 191 | 'DeletionCounterProject', |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments() && $namespace === 0; |
| 39 | 39 | $paSelect = $hasPageAssessments |
| 40 | - ? ", ( |
|
| 40 | + ? ", ( |
|
| 41 | 41 | SELECT pa_class |
| 42 | 42 | FROM page_assessments |
| 43 | 43 | WHERE pa_page_id = page_id |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments(); |
| 93 | 93 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
| 94 | 94 | $paSelect = $hasPageAssessments |
| 95 | - ? ", ( |
|
| 95 | + ? ", ( |
|
| 96 | 96 | SELECT pa_class |
| 97 | 97 | FROM $pageAssessmentsTable |
| 98 | 98 | WHERE pa_page_id = e.page_id |