@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | ) { |
| 60 | 60 | $this->project = $project; |
| 61 | 61 | $this->user = $user; |
| 62 | - $this->categories = array_map(function ($category) { |
|
| 62 | + $this->categories = array_map(function($category) { |
|
| 63 | 63 | return str_replace(' ', '_', $category); |
| 64 | 64 | }, $categories); |
| 65 | 65 | $this->start = false === $start ? '' : date('Y-m-d', $start); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function getCategoriesNormalized() |
| 93 | 93 | { |
| 94 | - return array_map(function ($category) { |
|
| 94 | + return array_map(function($category) { |
|
| 95 | 95 | return str_replace('_', ' ', $category); |
| 96 | 96 | }, $this->categories); |
| 97 | 97 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | private function getEditsFromRevs(array $revs) |
| 211 | 211 | { |
| 212 | - return array_map(function ($rev) { |
|
| 212 | + return array_map(function($rev) { |
|
| 213 | 213 | /* @var Page Page object to be passed to the Edit contructor. */ |
| 214 | 214 | $page = $this->getPageFromRev($rev); |
| 215 | 215 | $rev['user'] = $this->user; |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | // Send all to the template. |
| 158 | 158 | return $this->render('topedits/result_article.html.twig', [ |
| 159 | 159 | 'xtPage' => 'topedits', |
| 160 | - 'xtTitle' => $this->user->getUsername() . ' - ' . $this->page->getTitle(), |
|
| 160 | + 'xtTitle' => $this->user->getUsername().' - '.$this->page->getTitle(), |
|
| 161 | 161 | 'project' => $this->project, |
| 162 | 162 | 'user' => $this->user, |
| 163 | 163 | 'page' => $this->page, |
@@ -136,8 +136,8 @@ |
||
| 136 | 136 | $titles = []; |
| 137 | 137 | |
| 138 | 138 | while ($row = $sth->fetch()) { |
| 139 | - $titles[] = $namespaces[$row['page_namespace']] . |
|
| 140 | - ':' .$row['page_title']; |
|
| 139 | + $titles[] = $namespaces[$row['page_namespace']]. |
|
| 140 | + ':'.$row['page_title']; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Chunking... it's possible to make a URI too long |
@@ -347,7 +347,7 @@ |
||
| 347 | 347 | ]; |
| 348 | 348 | |
| 349 | 349 | if ($pages->getNumResults() === $pages->resultsPerPage()) { |
| 350 | - $ret['continue'] = $this->offset + 1; |
|
| 350 | + $ret['continue'] = $this->offset+1; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | return $this->getFormattedApiResponse($ret); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | 'total_editcount' => $this->autoEdits->getEditCount(), |
| 239 | 239 | 'automated_editcount' => $this->autoEdits->getAutomatedCount(), |
| 240 | 240 | ]; |
| 241 | - $ret['nonautomated_editcount'] = $ret['total_editcount'] - $ret['automated_editcount']; |
|
| 241 | + $ret['nonautomated_editcount'] = $ret['total_editcount']-$ret['automated_editcount']; |
|
| 242 | 242 | |
| 243 | 243 | if ($tools != '') { |
| 244 | 244 | $tools = $this->autoEdits->getToolCounts(); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | $this->setupAutoEdits(); |
| 272 | 272 | |
| 273 | - $ret = array_map(function ($rev) { |
|
| 273 | + $ret = array_map(function($rev) { |
|
| 274 | 274 | return array_merge([ |
| 275 | 275 | 'full_page_title' => $this->getPageFromNsAndTitle($rev['page_namespace'], $rev['page_title'], true), |
| 276 | 276 | ], $rev); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $ret['tool'] = $this->autoEdits->getTool(); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - $ret['automated_edits'] = array_map(function ($rev) { |
|
| 310 | + $ret['automated_edits'] = array_map(function($rev) { |
|
| 311 | 311 | return array_merge([ |
| 312 | 312 | 'full_page_title' => $this->getPageFromNsAndTitle($rev['page_namespace'], $rev['page_title'], true), |
| 313 | 313 | ], $rev); |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | |
| 198 | 198 | // Number the quotes, since they somehow have significance. |
| 199 | 199 | foreach ($quotes as $index => $quote) { |
| 200 | - $numberedQuotes[(string)($index + 1)] = $quote; |
|
| 200 | + $numberedQuotes[(string)($index+1)] = $quote; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return new JsonResponse($numberedQuotes, Response::HTTP_OK); |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | // Construct the page name |
| 114 | 114 | if (!isset($this->getParameter('rfx')[$domain]['pages'][$type])) { |
| 115 | - $pageTitle= ''; |
|
| 115 | + $pageTitle = ''; |
|
| 116 | 116 | } else { |
| 117 | - $pageTitle= $this->getParameter('rfx')[$domain]['pages'][$type]; |
|
| 117 | + $pageTitle = $this->getParameter('rfx')[$domain]['pages'][$type]; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $pageTitle.= '/'.$this->user->getUsername(); |
|
| 120 | + $pageTitle .= '/'.$this->user->getUsername(); |
|
| 121 | 121 | $page = new Page($this->project, $pageTitle); |
| 122 | 122 | $pageRepo = new PageRepository(); |
| 123 | 123 | $pageRepo->setContainer($this->container); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $neutral = $rfx->getSection('neutral'); |
| 146 | 146 | $dup = $rfx->getDuplicates(); |
| 147 | 147 | |
| 148 | - $total = count($support) + count($oppose) + count($neutral); |
|
| 148 | + $total = count($support)+count($oppose)+count($neutral); |
|
| 149 | 149 | |
| 150 | 150 | if ($total === 0) { |
| 151 | 151 | $this->addFlash('notice', ['no-result', $pageTitle]); |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | $this->setUpAdminStats(); |
| 152 | 152 | |
| 153 | 153 | // Maximum 30 days. |
| 154 | - $days = min((int) $days, 30); |
|
| 154 | + $days = min((int)$days, 30); |
|
| 155 | 155 | $start = date('Y-m-d', strtotime("-$days days")); |
| 156 | 156 | $end = date('Y-m-d'); |
| 157 | 157 | |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | $rendered = str_replace('"', '\"', trim($rendered)); |
| 84 | 84 | |
| 85 | 85 | // Uglify temporary file. |
| 86 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
| 86 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
| 87 | 87 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
| 88 | - $script .= $this->get('kernel')->getRootDir() . |
|
| 89 | - "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
| 88 | + $script .= $this->get('kernel')->getRootDir(). |
|
| 89 | + "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
| 90 | 90 | "&& rm $tmpFile >/dev/null"; |
| 91 | 91 | $process = new Process($script); |
| 92 | 92 | $process->run(); |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | $rendered = str_replace('\"', '"', trim($rendered)); |
| 106 | 106 | |
| 107 | 107 | // Add comment after uglifying since it removes comments. |
| 108 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
| 109 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
| 110 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
| 111 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
| 108 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
| 109 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
| 110 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
| 111 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $response = new Response($rendered); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $data = [ |
| 275 | 275 | 'project' => $project->getDomain(), |
| 276 | 276 | 'page' => $page->getTitle(), |
| 277 | - 'watchers' => (int) $page->getWatchers(), |
|
| 277 | + 'watchers' => (int)$page->getWatchers(), |
|
| 278 | 278 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
| 279 | 279 | 'pageviews_offset' => $pageviewsOffset, |
| 280 | 280 | ]; |
@@ -297,22 +297,22 @@ discard block |
||
| 297 | 297 | if ($info != false) { |
| 298 | 298 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
| 299 | 299 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
| 300 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
| 300 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
| 301 | 301 | |
| 302 | 302 | $assessment = $page->getProject() |
| 303 | 303 | ->getPageAssessments() |
| 304 | 304 | ->getAssessment($page); |
| 305 | 305 | |
| 306 | 306 | $data = array_merge($data, [ |
| 307 | - 'revisions' => (int) $info['num_edits'], |
|
| 308 | - 'editors' => (int) $info['num_editors'], |
|
| 307 | + 'revisions' => (int)$info['num_edits'], |
|
| 308 | + 'editors' => (int)$info['num_editors'], |
|
| 309 | 309 | 'author' => $info['author'], |
| 310 | - 'author_editcount' => (int) $info['author_editcount'], |
|
| 310 | + 'author_editcount' => (int)$info['author_editcount'], |
|
| 311 | 311 | 'created_at' => $creationDateTime->format('Y-m-d'), |
| 312 | 312 | 'created_rev_id' => $info['created_rev_id'], |
| 313 | 313 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
| 314 | 314 | 'secs_since_last_edit' => $secsSinceLastEdit, |
| 315 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
| 315 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
| 316 | 316 | 'assessment' => $assessment, |
| 317 | 317 | ]); |
| 318 | 318 | } |