@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $tagJoin = $tags != '' ? "LEFT OUTER JOIN $tagTable ON ct_rev_id = rev_id" : ''; |
52 | 52 | $condTools[] = "ct_tag IN ($tags)"; |
53 | 53 | } |
54 | - $condTool = 'AND (' . implode(' OR ', $condTools) . ')'; |
|
54 | + $condTool = 'AND ('.implode(' OR ', $condTools).')'; |
|
55 | 55 | |
56 | 56 | $sql = "SELECT COUNT(DISTINCT(rev_id)) |
57 | 57 | FROM $revisionTable |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $condEnd"; |
65 | 65 | |
66 | 66 | $resultQuery = $this->executeQuery($sql, $user, $namespace, $start, $end); |
67 | - $result = (int) $resultQuery->fetchColumn(); |
|
67 | + $result = (int)$resultQuery->fetchColumn(); |
|
68 | 68 | |
69 | 69 | // Cache for 10 minutes, and return. |
70 | 70 | $this->setCache($cacheKey, $result); |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | // Sort the array by count |
196 | - uasort($results, function ($a, $b) { |
|
197 | - return $b['count'] - $a['count']; |
|
196 | + uasort($results, function($a, $b) { |
|
197 | + return $b['count']-$a['count']; |
|
198 | 198 | }); |
199 | 199 | |
200 | 200 | // Cache for 10 minutes, and return. |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | // Developer error, no regex or tag provided for this tool. |
240 | 240 | if ($condTool === '') { |
241 | - throw new Exception("No regex or tag found for the tool $toolname. " . |
|
241 | + throw new Exception("No regex or tag found for the tool $toolname. ". |
|
242 | 242 | "Please verify this entry in semi_automated.yml"); |
243 | 243 | } |
244 | 244 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ($condTool === '') { |
285 | 285 | $condTool = "ct_tag = $tag"; |
286 | 286 | } else { |
287 | - $condTool = '(' . $condTool . " OR ct_tag = $tag)"; |
|
287 | + $condTool = '('.$condTool." OR ct_tag = $tag)"; |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 |
@@ -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 |