@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return $this->editCounts[$domain]; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $this->editCounts[$domain] = (int) $this->getRepository()->getEditCount( |
|
| 96 | + $this->editCounts[$domain] = (int)$this->getRepository()->getEditCount( |
|
| 97 | 97 | $project->getDatabaseName(), |
| 98 | 98 | $this->getUsername() |
| 99 | 99 | ); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function isAnon() |
| 161 | 161 | { |
| 162 | - return (bool) filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 162 | + return (bool)filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function countEdits(Project $project, $namespace = 'all', $start = '', $end = '') |
| 223 | 223 | { |
| 224 | - return (int) $this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 224 | + return (int)$this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | // Get individual counts of how many times each tool was used. |
| 127 | 127 | // This also includes a wikilink to the tool. |
| 128 | 128 | $toolCounts = $autoEdits->getAutomatedCounts(); |
| 129 | - $toolsTotal = array_reduce($toolCounts, function ($a, $b) { |
|
| 130 | - return $a + $b['count']; |
|
| 129 | + $toolsTotal = array_reduce($toolCounts, function($a, $b) { |
|
| 130 | + return $a+$b['count']; |
|
| 131 | 131 | }); |
| 132 | 132 | |
| 133 | 133 | // Query to get combined (semi)automated using for all edits |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $res['automated_editcount'] = $autoEdits->countAutomatedEdits(); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $res['nonautomated_editcount'] = $res['total_editcount'] - $res['automated_editcount']; |
|
| 206 | + $res['nonautomated_editcount'] = $res['total_editcount']-$res['automated_editcount']; |
|
| 207 | 207 | |
| 208 | 208 | $response->setData($res); |
| 209 | 209 | return $response; |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | if ($request->query->get('format') !== 'html') { |
| 244 | 244 | return new JsonResponse( |
| 245 | 245 | [ |
| 246 | - 'error' => 'Unable to show any data. User has made over ' . |
|
| 247 | - $user->maxEdits() . ' edits.', |
|
| 246 | + 'error' => 'Unable to show any data. User has made over '. |
|
| 247 | + $user->maxEdits().' edits.', |
|
| 248 | 248 | ], |
| 249 | 249 | Response::HTTP_FORBIDDEN |
| 250 | 250 | ); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | if ($request->query->get('format') === 'html') { |
| 264 | 264 | if ($edits) { |
| 265 | - $edits = array_map(function ($attrs) use ($project, $user) { |
|
| 265 | + $edits = array_map(function($attrs) use ($project, $user) { |
|
| 266 | 266 | $page = $project->getRepository() |
| 267 | 267 | ->getPage($project, $attrs['full_page_title']); |
| 268 | 268 | $pageTitles[] = $attrs['full_page_title']; |
@@ -232,7 +232,7 @@ |
||
| 232 | 232 | ]; |
| 233 | 233 | |
| 234 | 234 | if ($pages->getNumResults() === $pages->resultsPerPage()) { |
| 235 | - $ret['continue'] = $offset + 1; |
|
| 235 | + $ret['continue'] = $offset+1; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | $ret['pages'] = $pagesList; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $params = $this->convertLegacyParams($params); |
| 39 | 39 | |
| 40 | 40 | // Remove blank values. |
| 41 | - return array_filter($params, function ($param) { |
|
| 41 | + return array_filter($params, function($param) { |
|
| 42 | 42 | // 'namespace' or 'username' could be '0'. |
| 43 | 43 | return $param !== null && $param !== ''; |
| 44 | 44 | }); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $conn = $this->container->get('doctrine') |
| 331 | 331 | ->getManager('default') |
| 332 | 332 | ->getConnection(); |
| 333 | - $date = date('Y-m-d'); |
|
| 333 | + $date = date('Y-m-d'); |
|
| 334 | 334 | |
| 335 | 335 | // Increment count in timeline |
| 336 | 336 | $existsSql = "SELECT 1 FROM usage_api_timeline |
@@ -179,7 +179,7 @@ |
||
| 179 | 179 | $this->recordApiUsage('project/adminstats'); |
| 180 | 180 | |
| 181 | 181 | // Maximum 30 days. |
| 182 | - $days = min((int) $days, 30); |
|
| 182 | + $days = min((int)$days, 30); |
|
| 183 | 183 | $start = date('Y-m-d', strtotime("-$days days")); |
| 184 | 184 | $end = date('Y-m-d'); |
| 185 | 185 | |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | */ |
| 162 | 162 | public function getTotalEditCount() |
| 163 | 163 | { |
| 164 | - return $this->data['deletedEditCount'] + $this->data['liveEditCount']; |
|
| 164 | + return $this->data['deletedEditCount']+$this->data['liveEditCount']; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $timeline = []; |
| 96 | 96 | $startObj = new DateTime($start); |
| 97 | 97 | $endObj = new DateTime($end); |
| 98 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
| 98 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
| 99 | 99 | $grandSum = 0; |
| 100 | 100 | |
| 101 | 101 | // Generate array of date labels |
@@ -105,17 +105,17 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | foreach ($data as $entry) { |
| 107 | 107 | if (!isset($totals[$entry['tool']])) { |
| 108 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
| 108 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
| 109 | 109 | |
| 110 | 110 | // Create arrays for each tool, filled with zeros for each date in the timeline |
| 111 | 111 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
| 112 | 112 | } else { |
| 113 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
| 113 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $date = new DateTime($entry['date']); |
| 117 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
| 118 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
| 117 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
| 118 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
| 119 | 119 | |
| 120 | 120 | $grandSum += $entry['count']; |
| 121 | 121 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $timeline = []; |
| 153 | 153 | $startObj = new DateTime($start); |
| 154 | 154 | $endObj = new DateTime($end); |
| 155 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
| 155 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
| 156 | 156 | $grandSum = 0; |
| 157 | 157 | |
| 158 | 158 | // Generate array of date labels |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | foreach ($data as $entry) { |
| 164 | 164 | if (!isset($totals[$entry['endpoint']])) { |
| 165 | - $totals[$entry['endpoint']] = (int) $entry['count']; |
|
| 165 | + $totals[$entry['endpoint']] = (int)$entry['count']; |
|
| 166 | 166 | |
| 167 | 167 | // Create arrays for each endpoint, filled with zeros for each date in the timeline |
| 168 | 168 | $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0); |
| 169 | 169 | } else { |
| 170 | - $totals[$entry['endpoint']] += (int) $entry['count']; |
|
| 170 | + $totals[$entry['endpoint']] += (int)$entry['count']; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $date = new DateTime($entry['date']); |
| 174 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
| 175 | - $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count']; |
|
| 174 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
| 175 | + $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count']; |
|
| 176 | 176 | |
| 177 | 177 | $grandSum += $entry['count']; |
| 178 | 178 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $conn = $this->container->get('doctrine')->getManager('default')->getConnection(); |
| 222 | - $date = date('Y-m-d'); |
|
| 222 | + $date = date('Y-m-d'); |
|
| 223 | 223 | |
| 224 | 224 | // Increment count in timeline |
| 225 | 225 | $existsSql = "SELECT 1 FROM usage_timeline |
@@ -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' => $project->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 | ]; |
@@ -239,18 +239,18 @@ discard block |
||
| 239 | 239 | if (isset($info)) { |
| 240 | 240 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
| 241 | 241 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
| 242 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
| 242 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
| 243 | 243 | |
| 244 | 244 | $data = array_merge($data, [ |
| 245 | - 'revisions' => (int) $info['num_edits'], |
|
| 246 | - 'editors' => (int) $info['num_editors'], |
|
| 245 | + 'revisions' => (int)$info['num_edits'], |
|
| 246 | + 'editors' => (int)$info['num_editors'], |
|
| 247 | 247 | 'author' => $info['author'], |
| 248 | - 'author_editcount' => (int) $info['author_editcount'], |
|
| 248 | + 'author_editcount' => (int)$info['author_editcount'], |
|
| 249 | 249 | 'created_at' => $creationDateTime->format('Y-m-d'), |
| 250 | 250 | 'created_rev_id' => $info['created_rev_id'], |
| 251 | 251 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
| 252 | 252 | 'secs_since_last_edit' => $secsSinceLastEdit, |
| 253 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
| 253 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
| 254 | 254 | ]); |
| 255 | 255 | } |
| 256 | 256 | |