@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | $rendered = str_replace('"', '\"', trim($rendered)); |
| 87 | 87 | |
| 88 | 88 | // Uglify temporary file. |
| 89 | - $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js'; |
|
| 89 | + $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js'; |
|
| 90 | 90 | $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && "; |
| 91 | - $script .= $this->get('kernel')->getRootDir() . |
|
| 92 | - "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " . |
|
| 91 | + $script .= $this->get('kernel')->getRootDir(). |
|
| 92 | + "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ". |
|
| 93 | 93 | "&& rm $tmpFile >/dev/null"; |
| 94 | 94 | $process = new Process($script); |
| 95 | 95 | $process->run(); |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | $rendered = str_replace('\"', '"', trim($rendered)); |
| 109 | 109 | |
| 110 | 110 | // Add comment after uglifying since it removes comments. |
| 111 | - $rendered = "/**\n * This code was automatically generated and should not " . |
|
| 112 | - "be manually edited.\n * For updates, please copy and paste from " . |
|
| 113 | - $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) . |
|
| 114 | - "\n * Released under GPL v3 license.\n */\n" . $rendered; |
|
| 111 | + $rendered = "/**\n * This code was automatically generated and should not ". |
|
| 112 | + "be manually edited.\n * For updates, please copy and paste from ". |
|
| 113 | + $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL). |
|
| 114 | + "\n * Released under GPL v3 license.\n */\n".$rendered; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $response = new \Symfony\Component\HttpFoundation\Response($rendered); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $data = [ |
| 220 | 220 | 'project' => $projectData->getDomain(), |
| 221 | 221 | 'page' => $page->getTitle(), |
| 222 | - 'watchers' => (int) $page->getWatchers(), |
|
| 222 | + 'watchers' => (int)$page->getWatchers(), |
|
| 223 | 223 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
| 224 | 224 | 'pageviews_offset' => $pageviewsOffset, |
| 225 | 225 | ]; |
@@ -237,18 +237,18 @@ discard block |
||
| 237 | 237 | if (isset($info)) { |
| 238 | 238 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
| 239 | 239 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
| 240 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
| 240 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
| 241 | 241 | |
| 242 | 242 | $data = array_merge($data, [ |
| 243 | - 'revisions' => (int) $info['num_edits'], |
|
| 244 | - 'editors' => (int) $info['num_editors'], |
|
| 243 | + 'revisions' => (int)$info['num_edits'], |
|
| 244 | + 'editors' => (int)$info['num_editors'], |
|
| 245 | 245 | 'author' => $info['author'], |
| 246 | - 'author_editcount' => (int) $info['author_editcount'], |
|
| 246 | + 'author_editcount' => (int)$info['author_editcount'], |
|
| 247 | 247 | 'created_at' => $creationDateTime->format('Y-m-d'), |
| 248 | 248 | 'created_rev_id' => $info['created_rev_id'], |
| 249 | 249 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
| 250 | 250 | 'secs_since_last_edit' => $secsSinceLastEdit, |
| 251 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
| 251 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
| 252 | 252 | ]); |
| 253 | 253 | } |
| 254 | 254 | |