@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $timeline = []; |
105 | 105 | $startObj = new DateTime($start); |
106 | 106 | $endObj = new DateTime($end); |
107 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
107 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
108 | 108 | $grandSum = 0; |
109 | 109 | |
110 | 110 | // Generate array of date labels |
@@ -114,17 +114,17 @@ discard block |
||
114 | 114 | |
115 | 115 | foreach ($data as $entry) { |
116 | 116 | if (!isset($totals[$entry['tool']])) { |
117 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
117 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
118 | 118 | |
119 | 119 | // Create arrays for each tool, filled with zeros for each date in the timeline |
120 | 120 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
121 | 121 | } else { |
122 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
122 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | $date = new DateTime($entry['date']); |
126 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
127 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
126 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
127 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
128 | 128 | |
129 | 129 | $grandSum += $entry['count']; |
130 | 130 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $timeline = []; |
160 | 160 | $startObj = new DateTime($start); |
161 | 161 | $endObj = new DateTime($end); |
162 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
162 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
163 | 163 | $grandSum = 0; |
164 | 164 | |
165 | 165 | // Generate array of date labels |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | |
170 | 170 | foreach ($data as $entry) { |
171 | 171 | if (!isset($totals[$entry['endpoint']])) { |
172 | - $totals[$entry['endpoint']] = (int) $entry['count']; |
|
172 | + $totals[$entry['endpoint']] = (int)$entry['count']; |
|
173 | 173 | |
174 | 174 | // Create arrays for each endpoint, filled with zeros for each date in the timeline |
175 | 175 | $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0); |
176 | 176 | } else { |
177 | - $totals[$entry['endpoint']] += (int) $entry['count']; |
|
177 | + $totals[$entry['endpoint']] += (int)$entry['count']; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $date = new DateTime($entry['date']); |
181 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
182 | - $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count']; |
|
181 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
182 | + $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count']; |
|
183 | 183 | |
184 | 184 | $grandSum += $entry['count']; |
185 | 185 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | /** @var Connection $conn */ |
241 | 241 | $conn = $managerRegistry->getConnection('default'); |
242 | - $date = date('Y-m-d'); |
|
242 | + $date = date('Y-m-d'); |
|
243 | 243 | |
244 | 244 | // Tool name needs to be lowercase. |
245 | 245 | $tool = strtolower($tool); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\Repository; |
6 | 6 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
303 | 303 | |
304 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
304 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
305 | 305 | FROM wikidatawiki_p.wb_items_per_site |
306 | 306 | WHERE ips_item_id = :wikidataId"; |
307 | 307 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | 'wikidataId' => $wikidataId, |
310 | 310 | ])->fetchAllAssociative(); |
311 | 311 | |
312 | - return $count ? (int) $result[0]['count'] : $result; |
|
312 | + return $count ? (int)$result[0]['count'] : $result; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | // Transform to associative array by 'type' |
349 | 349 | foreach ($res as $row) { |
350 | - $data[$row['type'] . '_count'] = (int)$row['value']; |
|
350 | + $data[$row['type'].'_count'] = (int)$row['value']; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return $data; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | $project = $page->getProject()->getDomain(); |
390 | 390 | |
391 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
391 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
392 | 392 | "$project/all-access/user/$title/daily/$start/$end"; |
393 | 393 | |
394 | 394 | $res = $this->guzzle->request('GET', $url); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | { |
406 | 406 | if ($this->isWMF) { |
407 | 407 | $domain = $page->getProject()->getDomain(); |
408 | - $url = "https://$domain/api/rest_v1/page/html/" . urlencode(str_replace(' ', '_', $page->getTitle())); |
|
408 | + $url = "https://$domain/api/rest_v1/page/html/".urlencode(str_replace(' ', '_', $page->getTitle())); |
|
409 | 409 | if (null !== $revId) { |
410 | 410 | $url .= "/$revId"; |
411 | 411 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $normalized = []; |
470 | 470 | if (isset($result['query']['normalized'])) { |
471 | 471 | array_map( |
472 | - function ($e) use (&$normalized): void { |
|
472 | + function($e) use (&$normalized): void { |
|
473 | 473 | $normalized[$e['to']] = $e['from']; |
474 | 474 | }, |
475 | 475 | $result['query']['normalized'] |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace App\Exception; |
6 | 6 |