@@ -330,9 +330,9 @@ |
||
| 330 | 330 | { |
| 331 | 331 | $pageTable = $this->getTableName($project->getDatabaseName(), 'page'); |
| 332 | 332 | $query = "SELECT page_id " |
| 333 | - . " FROM $pageTable " |
|
| 334 | - . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
| 335 | - . " LIMIT 1"; |
|
| 333 | + . " FROM $pageTable " |
|
| 334 | + . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 " |
|
| 335 | + . " LIMIT 1"; |
|
| 336 | 336 | $params = [ |
| 337 | 337 | 'ns' => $namespaceId, |
| 338 | 338 | 'title' => str_replace(' ', '_', $pageTitle), |
@@ -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 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if ($this->parameterBag->has("database_meta_table")) { |
| 167 | - $table = $this->parameterBag->get('database_meta_name') . '.' . |
|
| 167 | + $table = $this->parameterBag->get('database_meta_name').'.'. |
|
| 168 | 168 | $this->parameterBag->get('database_meta_table'); |
| 169 | 169 | } else { |
| 170 | 170 | $table = "meta_p.wiki"; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | || $projMetadata['url'] == "https://$project" |
| 214 | 214 | || $projMetadata['url'] == "https://$project.org" |
| 215 | 215 | || $projMetadata['url'] == "https://www.$project") { |
| 216 | - $this->logger->debug(__METHOD__ . " Using cached data for $project"); |
|
| 216 | + $this->logger->debug(__METHOD__." Using cached data for $project"); |
|
| 217 | 217 | return $projMetadata; |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | ]])->getBody()->getContents(), true); |
| 410 | 410 | |
| 411 | 411 | $extensions = $res['query']['extensions'] ?? []; |
| 412 | - return array_map(function ($extension) { |
|
| 412 | + return array_map(function($extension) { |
|
| 413 | 413 | return $extension['name']; |
| 414 | 414 | }, $extensions); |
| 415 | 415 | } |
@@ -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 | |
@@ -213,9 +213,9 @@ |
||
| 213 | 213 | // Record character count and percentage for the remaining editors. |
| 214 | 214 | if ($percentageSum < 100) { |
| 215 | 215 | $this->data['others'] = [ |
| 216 | - 'count' => $totalCount - $countSum, |
|
| 217 | - 'percentage' => round(100 - $percentageSum, 1), |
|
| 218 | - 'numEditors' => count($counts) - $numEditors, |
|
| 216 | + 'count' => $totalCount-$countSum, |
|
| 217 | + 'percentage' => round(100-$percentageSum, 1), |
|
| 218 | + 'numEditors' => count($counts)-$numEditors, |
|
| 219 | 219 | ]; |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -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 | |
@@ -1319,10 +1319,10 @@ |
||
| 1319 | 1319 | // Slice to the top 10. |
| 1320 | 1320 | $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true)); |
| 1321 | 1321 | |
| 1322 | - // Get the sum of added text so that we can add in percentages. |
|
| 1323 | - $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
| 1324 | - return $this->editors[$editor]['added']; |
|
| 1325 | - }, $topTenEditorsByAdded)); |
|
| 1322 | + // Get the sum of added text so that we can add in percentages. |
|
| 1323 | + $topTenTotalAdded = array_sum(array_map(function ($editor) { |
|
| 1324 | + return $this->editors[$editor]['added']; |
|
| 1325 | + }, $topTenEditorsByAdded)); |
|
| 1326 | 1326 | |
| 1327 | 1327 | // Then build a new array of top 10 editors by added text in the data structure needed for the chart. |
| 1328 | 1328 | return array_map(function ($editor) use ($topTenTotalAdded) { |
@@ -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,16 +958,16 @@ 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). |
| 965 | - $this->editors[$editor]['atbe'] = round($days / ($info['all'] - 1), 1); |
|
| 965 | + $this->editors[$editor]['atbe'] = round($days / ($info['all']-1), 1); |
|
| 966 | 966 | } |
| 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,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace App\Model; |
| 5 | 5 | |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | if ($sorted) { |
| 102 | 102 | // Sort. |
| 103 | - uasort($this->globalEditCounts, function ($a, $b) { |
|
| 104 | - return $b['total'] - $a['total']; |
|
| 103 | + uasort($this->globalEditCounts, function($a, $b) { |
|
| 104 | + return $b['total']-$a['total']; |
|
| 105 | 105 | }); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $this->namespace, |
| 139 | 139 | $this->start, |
| 140 | 140 | $this->end, |
| 141 | - $this->limit + 1, |
|
| 141 | + $this->limit+1, |
|
| 142 | 142 | $this->offset |
| 143 | 143 | ); |
| 144 | 144 | $globalEdits = []; |
@@ -20,4 +20,4 @@ |
||
| 20 | 20 | $_SERVER += $_ENV; |
| 21 | 21 | $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; |
| 22 | 22 | $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; |
| 23 | -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; |
|
| 23 | +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int)$_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; |
|
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | return [ |
| 5 | 5 | Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | Request::setTrustedHosts([$trustedHosts]); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); |
|
| 23 | +$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']); |
|
| 24 | 24 | $request = Request::createFromGlobals(); |
| 25 | 25 | $response = $kernel->handle($request); |
| 26 | 26 | $response->send(); |