@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the User class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | return $this->editCounts[$domain]; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $this->editCounts[$domain] = (int) $this->getRepository()->getEditCount( |
|
| 126 | + $this->editCounts[$domain] = (int)$this->getRepository()->getEditCount( |
|
| 127 | 127 | $project->getDatabaseName(), |
| 128 | 128 | $this->getUsername() |
| 129 | 129 | ); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function isAnon(): bool |
| 169 | 169 | { |
| 170 | - return (bool) filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 170 | + return (bool)filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function countEdits(Project $project, $namespace = 'all', $start = '', $end = ''): int |
| 230 | 230 | { |
| 231 | - return (int) $this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 231 | + return (int)$this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the Page class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $info = $this->getPageInfo(); |
| 94 | 94 | $title = $info['title'] ?? $this->unnormalizedPageName; |
| 95 | 95 | $nsName = $this->getNamespaceName(); |
| 96 | - return str_replace($nsName . ':', '', $title); |
|
| 96 | + return str_replace($nsName.':', '', $title); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | { |
| 292 | 292 | $content = $this->getRepository()->getPagesWikitext( |
| 293 | 293 | $this->getProject(), |
| 294 | - [ $this->getTitle() ] |
|
| 294 | + [$this->getTitle()] |
|
| 295 | 295 | ); |
| 296 | 296 | |
| 297 | 297 | return $content[$this->getTitle()] ?? null; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | $wikidataInfo = $this->getRepository()->getWikidataInfo($this); |
| 361 | 361 | |
| 362 | - $terms = array_map(function ($entry) { |
|
| 362 | + $terms = array_map(function($entry) { |
|
| 363 | 363 | return $entry['term']; |
| 364 | 364 | }, $wikidataInfo); |
| 365 | 365 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | 'prio' => 2, |
| 371 | 371 | 'name' => 'Wikidata', |
| 372 | 372 | 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n |
| 373 | - 'explanation' => "See: <a target='_blank' " . |
|
| 373 | + 'explanation' => "See: <a target='_blank' ". |
|
| 374 | 374 | "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>", |
| 375 | 375 | ]; |
| 376 | 376 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | 'prio' => 3, |
| 381 | 381 | 'name' => 'Wikidata', |
| 382 | 382 | 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n |
| 383 | - 'explanation' => "See: <a target='_blank' " . |
|
| 383 | + 'explanation' => "See: <a target='_blank' ". |
|
| 384 | 384 | "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>", |
| 385 | 385 | ]; |
| 386 | 386 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | return 0; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - return array_sum(array_map(function ($item) { |
|
| 461 | + return array_sum(array_map(function($item) { |
|
| 462 | 462 | return (int)$item['views']; |
| 463 | 463 | }, $pageviews['items'])); |
| 464 | 464 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the SimpleEditCounter class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function getTotalEditCount(): int |
| 122 | 122 | { |
| 123 | - return $this->data['deletedEditCount'] + $this->data['liveEditCount']; |
|
| 123 | + return $this->data['deletedEditCount']+$this->data['liveEditCount']; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | * This file contains only the Model class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the ArticleInfo class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | public function getMaxRevisions(): int |
| 244 | 244 | { |
| 245 | 245 | if (!isset($this->maxRevisions)) { |
| 246 | - $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions'); |
|
| 246 | + $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions'); |
|
| 247 | 247 | } |
| 248 | 248 | return $this->maxRevisions; |
| 249 | 249 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | $this->yearMonthCounts[$editYear]['all']++; |
| 1013 | 1013 | $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']++; |
| 1014 | 1014 | // This will ultimately be the size of the page by the end of the year |
| 1015 | - $this->yearMonthCounts[$editYear]['size'] = (int) $edit->getLength(); |
|
| 1015 | + $this->yearMonthCounts[$editYear]['size'] = (int)$edit->getLength(); |
|
| 1016 | 1016 | |
| 1017 | 1017 | // Keep track of which month had the most edits |
| 1018 | 1018 | $editsThisMonth = $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']; |
@@ -1167,8 +1167,8 @@ discard block |
||
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | 1169 | // Sort by edit count. |
| 1170 | - uasort($bots, function ($a, $b) { |
|
| 1171 | - return $b['count'] - $a['count']; |
|
| 1170 | + uasort($bots, function($a, $b) { |
|
| 1171 | + return $b['count']-$a['count']; |
|
| 1172 | 1172 | }); |
| 1173 | 1173 | |
| 1174 | 1174 | $this->bots = $bots; |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | |
| 1278 | 1278 | if ($info['all'] > 1) { |
| 1279 | 1279 | // Number of seconds/days between first and last edit. |
| 1280 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
| 1280 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
| 1281 | 1281 | $days = $secs / (60 * 60 * 24); |
| 1282 | 1282 | |
| 1283 | 1283 | // Average time between edits (in days). |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | // Loop through again and add percentages. |
| 1289 | - $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) { |
|
| 1289 | + $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) { |
|
| 1290 | 1290 | $editor['percentage'] = 100 * ($editor['value'] / $topTenCount); |
| 1291 | 1291 | return $editor; |
| 1292 | 1292 | }, $topTenEditorsByEdits); |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | { |
| 1305 | 1305 | // First sort editors array by the amount of text they added. |
| 1306 | 1306 | $topTenEditorsByAdded = $this->editors; |
| 1307 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
| 1307 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
| 1308 | 1308 | if ($a['added'] === $b['added']) { |
| 1309 | 1309 | return 0; |
| 1310 | 1310 | } |
@@ -1320,7 +1320,7 @@ discard block |
||
| 1320 | 1320 | // }, $topTenEditorsByAdded)); |
| 1321 | 1321 | |
| 1322 | 1322 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
| 1323 | - return array_map(function ($editor) { |
|
| 1323 | + return array_map(function($editor) { |
|
| 1324 | 1324 | $added = $this->editors[$editor]['added']; |
| 1325 | 1325 | return [ |
| 1326 | 1326 | 'label' => $editor, |
@@ -1470,7 +1470,7 @@ discard block |
||
| 1470 | 1470 | |
| 1471 | 1471 | $refs = $crawler->filter('#mw-content-text .reference'); |
| 1472 | 1472 | $refContent = []; |
| 1473 | - $refs->each(function ($ref) use (&$refContent): void { |
|
| 1473 | + $refs->each(function($ref) use (&$refContent): void { |
|
| 1474 | 1474 | $refContent[] = $ref->text(); |
| 1475 | 1475 | }); |
| 1476 | 1476 | $uniqueRefs = count(array_unique($refContent)); |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | $totalChars = 0; |
| 1498 | 1498 | $totalWords = 0; |
| 1499 | 1499 | $paragraphs = $crawler->filter($selector); |
| 1500 | - $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void { |
|
| 1500 | + $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void { |
|
| 1501 | 1501 | $text = preg_replace('/\[\d+\]/', '', trim($node->text())); |
| 1502 | 1502 | $totalChars += strlen($text); |
| 1503 | 1503 | $totalWords += count(explode(' ', $text)); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the Project class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function getUrl(bool $withTrailingSlash = true): string |
| 147 | 147 | { |
| 148 | - return rtrim($this->getBasicInfo()['url'], '/') . ($withTrailingSlash ? '/' : ''); |
|
| 148 | + return rtrim($this->getBasicInfo()['url'], '/').($withTrailingSlash ? '/' : ''); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | public function getScript(): string |
| 191 | 191 | { |
| 192 | 192 | $metadata = $this->getMetadata(); |
| 193 | - return $metadata['general']['script'] ?? $this->getScriptPath() . '/index.php'; |
|
| 193 | + return $metadata['general']['script'] ?? $this->getScriptPath().'/index.php'; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function getApiUrl(): string |
| 201 | 201 | { |
| 202 | - return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath(); |
|
| 202 | + return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath(); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public function userOptInPage(User $user): string |
| 260 | 260 | { |
| 261 | - $localPageName = 'User:' . $user->getUsername() . '/EditCounterOptIn.js'; |
|
| 261 | + $localPageName = 'User:'.$user->getUsername().'/EditCounterOptIn.js'; |
|
| 262 | 262 | return $localPageName; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // 4. Lastly, see if they've opted in globally on the default project or Meta. |
| 296 | - $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js'; |
|
| 296 | + $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js'; |
|
| 297 | 297 | $globalProject = $this->getRepository()->getGlobalProject(); |
| 298 | 298 | if ($globalProject instanceof Project) { |
| 299 | 299 | $globalExists = $globalProject->getRepository() |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * An RFX object contains the parsed information for an RFX |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $final = []; // initialize the final array |
|
| 109 | + $final = []; // initialize the final array |
|
| 110 | 110 | $finalRaw = []; // Initialize the raw data array |
| 111 | 111 | |
| 112 | 112 | foreach (array_keys($this->data) as $key) { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $final = array_count_values($final); // find repetition and its count |
| 121 | 121 | |
| 122 | - $final = array_diff($final, [1]); // remove single occurrences |
|
| 122 | + $final = array_diff($final, [1]); // remove single occurrences |
|
| 123 | 123 | |
| 124 | 124 | $this->duplicates = array_keys($final); |
| 125 | 125 | } |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | * This file contains only the UserRights class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * This file contains only the AutoEdits class. |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -declare(strict_types = 1); |
|
| 6 | +declare(strict_types=1); |
|
| 7 | 7 | |
| 8 | 8 | namespace AppBundle\Model; |
| 9 | 9 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | private function getEditsFromRevs(array $revs): array |
| 190 | 190 | { |
| 191 | - return array_map(function ($rev) { |
|
| 191 | + return array_map(function($rev) { |
|
| 192 | 192 | /** @var Page $page Page object to be passed to the Edit contructor. */ |
| 193 | 193 | $page = $this->getPageFromRev($rev); |
| 194 | 194 | $rev['user'] = $this->user; |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | public function getToolsTotal(): int |
| 252 | 252 | { |
| 253 | 253 | if (!is_int($this->toolsTotal)) { |
| 254 | - $this->toolsTotal = array_reduce($this->getToolCounts(), function ($a, $b) { |
|
| 255 | - return $a + $b['count']; |
|
| 254 | + $this->toolsTotal = array_reduce($this->getToolCounts(), function($a, $b) { |
|
| 255 | + return $a+$b['count']; |
|
| 256 | 256 | }); |
| 257 | 257 | } |
| 258 | 258 | |