@@ -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 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | $wikidataId = ltrim($page->getWikidataId(), 'Q'); |
304 | 304 | |
305 | - $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . " |
|
305 | + $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')." |
|
306 | 306 | FROM wikidatawiki_p.wb_items_per_site |
307 | 307 | WHERE ips_item_id = :wikidataId"; |
308 | 308 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | 'wikidataId' => $wikidataId, |
311 | 311 | ])->fetchAllAssociative(); |
312 | 312 | |
313 | - return $count ? (int) $result[0]['count'] : $result; |
|
313 | + return $count ? (int)$result[0]['count'] : $result; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | // Transform to associative array by 'type' |
350 | 350 | foreach ($res as $row) { |
351 | - $data[$row['type'] . '_count'] = (int)$row['value']; |
|
351 | + $data[$row['type'].'_count'] = (int)$row['value']; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return $data; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | $project = $page->getProject()->getDomain(); |
394 | 394 | |
395 | - $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' . |
|
395 | + $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'. |
|
396 | 396 | "$project/all-access/user/$title/daily/$start/$end"; |
397 | 397 | |
398 | 398 | $res = $client->request('GET', $url); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $normalized = []; |
469 | 469 | if (isset($result['query']['normalized'])) { |
470 | 470 | array_map( |
471 | - function ($e) use (&$normalized): void { |
|
471 | + function($e) use (&$normalized): void { |
|
472 | 472 | $normalized[$e['to']] = $e['from']; |
473 | 473 | }, |
474 | 474 | $result['query']['normalized'] |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Repository; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Repository; |
5 | 5 |
@@ -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 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $hasPageAssessments = $this->isWMF && $project->hasPageAssessments() && 0 === $namespace; |
87 | 87 | $paTable = $project->getTableName('page_assessments'); |
88 | 88 | $paSelect = $hasPageAssessments |
89 | - ? ", ( |
|
89 | + ? ", ( |
|
90 | 90 | SELECT pa_class |
91 | 91 | FROM $paTable |
92 | 92 | WHERE pa_page_id = page_id |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $hasPageAssessments = $this->isWMF && $project->hasPageAssessments(); |
201 | 201 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
202 | 202 | $paSelect = $hasPageAssessments |
203 | - ? ", ( |
|
203 | + ? ", ( |
|
204 | 204 | SELECT pa_class |
205 | 205 | FROM $pageAssessmentsTable |
206 | 206 | WHERE pa_page_id = e.page_id |
@@ -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 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $revDateConditions = $this->getDateConditions($start, $end, false, "$ipcTable.", 'ipc_rev_timestamp'); |
120 | 120 | [$startHex, $endHex] = IPUtils::parseRange($user->getUsername()); |
121 | 121 | |
122 | - $revNamespaceJoinSql = 'all' === $namespace ? '' : "JOIN $revTable ON rev_id = ipc_rev_id " . |
|
122 | + $revNamespaceJoinSql = 'all' === $namespace ? '' : "JOIN $revTable ON rev_id = ipc_rev_id ". |
|
123 | 123 | "JOIN $pageTable ON rev_page = page_id"; |
124 | 124 | $revNamespaceWhereSql = 'all' === $namespace ? '' : "AND page_namespace = $namespace"; |
125 | 125 |
@@ -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 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return $this->cache->getItem($cacheKey)->get(); |
114 | 114 | } |
115 | 115 | |
116 | - $rightsPaths = array_map(function ($right) { |
|
116 | + $rightsPaths = array_map(function($right) { |
|
117 | 117 | return "Group-$right-member"; |
118 | 118 | }, $this->getRawRightsNames($project)); |
119 | 119 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | FROM $revisionTable |
257 | 257 | WHERE rev_actor = :actorId |
258 | 258 | AND rev_timestamp >= $offset |
259 | - LIMIT 1 OFFSET ".($edits - 1); |
|
259 | + LIMIT 1 OFFSET ".($edits-1); |
|
260 | 260 | |
261 | 261 | $ret = $this->executeProjectsQuery($project, $sql, [ |
262 | 262 | 'actorId' => $user->getActorId($project), |
@@ -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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | if ('all' !== $namespace) { |
53 | 53 | // Limit by namespace. |
54 | - return array_filter($this->aeTools, function (array $tool) use ($namespace) { |
|
54 | + return array_filter($this->aeTools, function(array $tool) use ($namespace) { |
|
55 | 55 | return empty($tool['namespaces']) || |
56 | 56 | in_array((int)$namespace, $tool['namespaces']) || |
57 | 57 | ( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $tagJoin = "LEFT OUTER JOIN $tagTable ON ct_rev_id = rev_id"; |
148 | 148 | $condTools[] = "ct_tag_id IN ($tagIds)"; |
149 | 149 | } |
150 | - $condTool = 'AND (' . implode(' OR ', $condTools) . ')'; |
|
150 | + $condTool = 'AND ('.implode(' OR ', $condTools).')'; |
|
151 | 151 | |
152 | 152 | $sql = "SELECT COUNT(DISTINCT(rev_id)) |
153 | 153 | FROM $revisionTable |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | } |
393 | 393 | |
394 | 394 | // Sort the array by count |
395 | - uasort($results, function ($a, $b) { |
|
396 | - return $b['count'] - $a['count']; |
|
395 | + uasort($results, function($a, $b) { |
|
396 | + return $b['count']-$a['count']; |
|
397 | 397 | }); |
398 | 398 | |
399 | 399 | // Cache and return. |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | if (isset($values['tags'])) { |
585 | 585 | $tags = array_merge( |
586 | 586 | $tags, |
587 | - array_map(function ($tag) use ($conn) { |
|
587 | + array_map(function($tag) use ($conn) { |
|
588 | 588 | return $conn->quote($tag, PDO::PARAM_STR); |
589 | 589 | }, $values['tags']) |
590 | 590 | ); |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | |
619 | 619 | if ($tagExcludes && 1 === count($tagIds)) { |
620 | 620 | // Get tag IDs, filtering out those for which no ID exists (meaning there is no local tag for that tool). |
621 | - $excludesList = implode(',', array_filter(array_map(function ($tagName) use ($project) { |
|
621 | + $excludesList = implode(',', array_filter(array_map(function($tagName) use ($project) { |
|
622 | 622 | return $this->getTags($project)[$tagName] ?? null; |
623 | 623 | }, $tagExcludes))); |
624 | 624 |
@@ -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 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp' |
146 | 146 | FROM $loggingTable |
147 | - WHERE log_namespace = '" . $page->getNamespace() . "' |
|
147 | + WHERE log_namespace = '".$page->getNamespace()."' |
|
148 | 148 | AND log_title = :title AND log_timestamp > 1 $datesConditions |
149 | 149 | AND log_type IN ('delete', 'move', 'protect', 'stable')"; |
150 | 150 | $title = str_replace(' ', '_', $page->getTitle()); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $time2 = time(); |
328 | 328 | |
329 | 329 | // If it took over 5 seconds, cache the result for 20 minutes. |
330 | - if ($time2 - $time1 > 5) { |
|
330 | + if ($time2-$time1 > 5) { |
|
331 | 331 | $this->setCache($cacheKey, $result, 'PT20M'); |
332 | 332 | } |
333 | 333 |
@@ -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\Model; |
6 | 6 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $numResults = count($this->getResults()[$this->getNamespace()]); |
130 | - $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults - 1]['rev_timestamp']); |
|
130 | + $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults-1]['rev_timestamp']); |
|
131 | 131 | return $timestamp->format('Y-m-d\TH:i:s'); |
132 | 132 | } |
133 | 133 |