@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | // supply as the OFFSET. |
| 152 | 152 | $limitClause = ''; |
| 153 | 153 | if (intval($limit) > 0 && isset($numRevisions)) { |
| 154 | - $offset = $numRevisions - $limit; |
|
| 154 | + $offset = $numRevisions-$limit; |
|
| 155 | 155 | $limitClause = "LIMIT $offset, $limit"; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $time2 = time(); |
| 290 | 290 | |
| 291 | 291 | // If it took over 5 seconds, cache the result for 20 minutes. |
| 292 | - if ($time2 - $time1 > 5) { |
|
| 292 | + if ($time2-$time1 > 5) { |
|
| 293 | 293 | $this->setCache($cacheKey, $result, 'PT20M'); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
| 410 | 410 | |
| 411 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
| 411 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
| 412 | 412 | FROM wikidatawiki_p.wb_items_per_site |
| 413 | 413 | WHERE ips_item_id = :wikidataId"; |
| 414 | 414 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | 'wikidataId' => $wikidataId, |
| 417 | 417 | ])->fetchAll(); |
| 418 | 418 | |
| 419 | - return $count ? (int) $result[0]['count'] : $result; |
|
| 419 | + return $count ? (int)$result[0]['count'] : $result; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | // Transform to associative array by 'type' |
| 456 | 456 | foreach ($res as $row) { |
| 457 | - $data[$row['type'] . '_count'] = $row['value']; |
|
| 457 | + $data[$row['type'].'_count'] = $row['value']; |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return $data; |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | $project = $page->getProject()->getDomain(); |
| 498 | 498 | |
| 499 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
| 499 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
| 500 | 500 | "$project/all-access/user/$title/daily/$start/$end"; |
| 501 | 501 | |
| 502 | 502 | $res = $client->request('GET', $url); |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | $normalized = []; |
| 569 | 569 | if (isset($result['query']['normalized'])) { |
| 570 | 570 | array_map( |
| 571 | - function ($e) use (&$normalized) { |
|
| 571 | + function($e) use (&$normalized) { |
|
| 572 | 572 | $normalized[$e['to']] = $e['from']; |
| 573 | 573 | }, |
| 574 | 574 | $result['query']['normalized'] |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | $response->setEncodingOptions(JSON_NUMERIC_CHECK); |
| 320 | 320 | |
| 321 | 321 | $res['automated_editcount'] = $this->autoEdits->getAutomatedCount(); |
| 322 | - $res['nonautomated_editcount'] = $res['total_editcount'] - $res['automated_editcount']; |
|
| 322 | + $res['nonautomated_editcount'] = $res['total_editcount']-$res['automated_editcount']; |
|
| 323 | 323 | |
| 324 | 324 | if ($tools != '') { |
| 325 | 325 | $tools = $this->autoEdits->getToolCounts(); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | $namespaces = $this->project->getNamespaces(); |
| 368 | 368 | |
| 369 | - $ret['nonautomated_edits'] = array_map(function ($rev) use ($namespaces) { |
|
| 369 | + $ret['nonautomated_edits'] = array_map(function($rev) use ($namespaces) { |
|
| 370 | 370 | $pageTitle = $rev['page_title']; |
| 371 | 371 | if ((int)$rev['page_namespace'] === 0) { |
| 372 | 372 | $fullPageTitle = $pageTitle; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | $namespaces = $this->project->getNamespaces(); |
| 422 | 422 | |
| 423 | - $ret['nonautomated_edits'] = array_map(function ($rev) use ($namespaces) { |
|
| 423 | + $ret['nonautomated_edits'] = array_map(function($rev) use ($namespaces) { |
|
| 424 | 424 | $pageTitle = $rev['page_title']; |
| 425 | 425 | if ((int)$rev['page_namespace'] === 0) { |
| 426 | 426 | $fullPageTitle = $pageTitle; |