@@ -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 | |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | |
959 | 959 | if ($info['all'] > 1) { |
960 | 960 | // Number of seconds/days between first and last edit. |
961 | - $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp(); |
|
961 | + $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp(); |
|
962 | 962 | $days = $secs / (60 * 60 * 24); |
963 | 963 | |
964 | 964 | // Average time between edits (in days). |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | } |
968 | 968 | |
969 | 969 | // Loop through again and add percentages. |
970 | - $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) { |
|
970 | + $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) { |
|
971 | 971 | $editor['percentage'] = 100 * ($editor['value'] / $topTenCount); |
972 | 972 | return $editor; |
973 | 973 | }, $topTenEditorsByEdits); |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | { |
986 | 986 | // First sort editors array by the amount of text they added. |
987 | 987 | $topTenEditorsByAdded = $this->editors; |
988 | - uasort($topTenEditorsByAdded, function ($a, $b) { |
|
988 | + uasort($topTenEditorsByAdded, function($a, $b) { |
|
989 | 989 | if ($a['added'] === $b['added']) { |
990 | 990 | return 0; |
991 | 991 | } |
@@ -996,12 +996,12 @@ discard block |
||
996 | 996 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
997 | 997 | |
998 | 998 | // Get the sum of added text so that we can add in percentages. |
999 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
999 | + $topTenTotalAdded = array_sum(array_map(function($editor) { |
|
1000 | 1000 | return $this->editors[$editor]['added']; |
1001 | 1001 | }, $topTenEditorsByAdded)); |
1002 | 1002 | |
1003 | 1003 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
1004 | - return array_map(function ($editor) use ($topTenTotalAdded) { |
|
1004 | + return array_map(function($editor) use ($topTenTotalAdded) { |
|
1005 | 1005 | $added = $this->editors[$editor]['added']; |
1006 | 1006 | return [ |
1007 | 1007 | 'label' => $editor, |
@@ -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 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $firstDateTime = $this->topEdits[0]->getTimestamp(); |
165 | 165 | $lastDateTime = end($this->topEdits)->getTimestamp(); |
166 | - $secs = $firstDateTime->getTimestamp() - $lastDateTime->getTimestamp(); |
|
166 | + $secs = $firstDateTime->getTimestamp()-$lastDateTime->getTimestamp(); |
|
167 | 167 | $days = $secs / (60 * 60 * 24); |
168 | 168 | return $days / count($this->topEdits); |
169 | 169 | } |
@@ -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 | |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | $firstAddrUnpacked = unpack('H*', $firstAddrBin); |
127 | 127 | $firstAddrHex = reset($firstAddrUnpacked); |
128 | 128 | $range[0] = inet_ntop($firstAddrBin); |
129 | - $flexBits = 128 - $prefixLen; |
|
129 | + $flexBits = 128-$prefixLen; |
|
130 | 130 | $lastAddrHex = $firstAddrHex; |
131 | 131 | |
132 | 132 | $pos = 31; |
133 | 133 | while ($flexBits > 0) { |
134 | 134 | $orig = substr($lastAddrHex, $pos, 1); |
135 | 135 | $origVal = hexdec($orig); |
136 | - $newVal = $origVal | (pow(2, min(4, $flexBits)) - 1); |
|
136 | + $newVal = $origVal | (pow(2, min(4, $flexBits))-1); |
|
137 | 137 | $new = dechex($newVal); |
138 | 138 | $lastAddrHex = substr_replace($lastAddrHex, $new, $pos, 1); |
139 | 139 | $flexBits -= 4; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $range[1] = inet_ntop($lastAddrBin); |
145 | 145 | } else { |
146 | 146 | $cidr = explode('/', $this->username); |
147 | - $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32 - (int)$cidr[1])); |
|
148 | - $range[1] = long2ip(ip2long($range[0]) + pow(2, (32 - (int)$cidr[1])) - 1); |
|
147 | + $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32-(int)$cidr[1])); |
|
148 | + $range[1] = long2ip(ip2long($range[0])+pow(2, (32-(int)$cidr[1]))-1); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Find the leftmost common characters between the two addresses. |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function countEdits(Project $project, $namespace = 'all', $start = false, $end = false): int |
355 | 355 | { |
356 | - return (int) $this->repository->countEdits($project, $this, $namespace, $start, $end); |
|
356 | + return (int)$this->repository->countEdits($project, $this, $namespace, $start, $end); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -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 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getTotalEditCount(): int |
156 | 156 | { |
157 | - return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count'] + $this->data['live_edit_count']; |
|
157 | + return $this->data['total_edit_count'] ?? $this->data['deleted_edit_count']+$this->data['live_edit_count']; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | 4 | namespace App\Model; |
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\Twig; |
6 | 6 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | public function requestTime(): float |
118 | 118 | { |
119 | 119 | if (!isset($this->requestTime)) { |
120 | - $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
120 | + $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $this->requestTime; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | $sizeMessage = $this->numberFormat( |
547 | - pow(1024, $base - floor($base)), |
|
547 | + pow(1024, $base-floor($base)), |
|
548 | 548 | $precision |
549 | 549 | ); |
550 | 550 | |
@@ -701,15 +701,15 @@ discard block |
||
701 | 701 | |
702 | 702 | if ($seconds >= 86400) { |
703 | 703 | // Over a day |
704 | - $val = (int) floor($seconds / 86400); |
|
704 | + $val = (int)floor($seconds / 86400); |
|
705 | 705 | $key = 'days'; |
706 | 706 | } elseif ($seconds >= 3600) { |
707 | 707 | // Over an hour, less than a day |
708 | - $val = (int) floor($seconds / 3600); |
|
708 | + $val = (int)floor($seconds / 3600); |
|
709 | 709 | $key = 'hours'; |
710 | 710 | } elseif ($seconds >= 60) { |
711 | 711 | // Over a minute, less than an hour |
712 | - $val = (int) floor($seconds / 60); |
|
712 | + $val = (int)floor($seconds / 60); |
|
713 | 713 | $key = 'minutes'; |
714 | 714 | } |
715 | 715 |
@@ -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\EventSubscriber; |
6 | 6 |
@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->repository = $repository; |
49 | 49 | $this->project = $project; |
50 | 50 | $this->user = $user; |
51 | - $this->categories = array_map(function ($category) { |
|
51 | + $this->categories = array_map(function($category) { |
|
52 | 52 | return str_replace(' ', '_', $category); |
53 | 53 | }, $categories); |
54 | 54 | $this->start = $start; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getCategoriesNormalized(): array |
82 | 82 | { |
83 | - return array_map(function ($category) { |
|
83 | + return array_map(function($category) { |
|
84 | 84 | return str_replace('_', ' ', $category); |
85 | 85 | }, $this->categories); |
86 | 86 | } |
@@ -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 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $refs = $crawler->filter('#mw-content-text .reference'); |
171 | 171 | $refContent = []; |
172 | - $refs->each(function ($ref) use (&$refContent): void { |
|
172 | + $refs->each(function($ref) use (&$refContent): void { |
|
173 | 173 | $refContent[] = $ref->text(); |
174 | 174 | }); |
175 | 175 | $uniqueRefs = count(array_unique($refContent)); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $totalChars = 0; |
198 | 198 | $totalWords = 0; |
199 | 199 | $paragraphs = $crawler->filter($selector); |
200 | - $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void { |
|
200 | + $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void { |
|
201 | 201 | /** @var Crawler $node */ |
202 | 202 | $text = preg_replace('/\[\d+]/', '', trim($node->text(null, true))); |
203 | 203 | $totalChars += strlen($text); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $data = [ |
262 | 262 | 'project' => $project->getDomain(), |
263 | 263 | 'page' => $page->getTitle(), |
264 | - 'watchers' => (int) $page->getWatchers(), |
|
264 | + 'watchers' => (int)$page->getWatchers(), |
|
265 | 265 | 'pageviews' => $page->getLastPageviews($pageviewsOffset), |
266 | 266 | 'pageviews_offset' => $pageviewsOffset, |
267 | 267 | ]; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ($info) { |
285 | 285 | $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']); |
286 | 286 | $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']); |
287 | - $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp(); |
|
287 | + $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp(); |
|
288 | 288 | |
289 | 289 | // Some wikis (such foundation.wikimedia.org) may be missing the creation date. |
290 | 290 | $creationDateTime = false === $creationDateTime |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | ->getAssessment($page); |
297 | 297 | |
298 | 298 | $data = array_merge($data, [ |
299 | - 'revisions' => (int) $info['num_edits'], |
|
300 | - 'editors' => (int) $info['num_editors'], |
|
301 | - 'minor_edits' => (int) $info['minor_edits'], |
|
299 | + 'revisions' => (int)$info['num_edits'], |
|
300 | + 'editors' => (int)$info['num_editors'], |
|
301 | + 'minor_edits' => (int)$info['minor_edits'], |
|
302 | 302 | 'author' => $info['author'], |
303 | - 'author_editcount' => null === $info['author_editcount'] ? null : (int) $info['author_editcount'], |
|
303 | + 'author_editcount' => null === $info['author_editcount'] ? null : (int)$info['author_editcount'], |
|
304 | 304 | 'created_at' => $creationDateTime, |
305 | 305 | 'created_rev_id' => $info['created_rev_id'], |
306 | 306 | 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'), |
307 | 307 | 'secs_since_last_edit' => $secsSinceLastEdit, |
308 | - 'last_edit_id' => (int) $info['modified_rev_id'], |
|
308 | + 'last_edit_id' => (int)$info['modified_rev_id'], |
|
309 | 309 | 'assessment' => $assessment, |
310 | 310 | ]); |
311 | 311 | } |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | } |
456 | 456 | |
457 | 457 | // Sort by edit count. |
458 | - uasort($this->bots, function ($a, $b) { |
|
459 | - return $b['count'] - $a['count']; |
|
458 | + uasort($this->bots, function($a, $b) { |
|
459 | + return $b['count']-$a['count']; |
|
460 | 460 | }); |
461 | 461 | |
462 | 462 | return $this->bots; |