@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $timeline = []; |
| 102 | 102 | $startObj = new DateTime($start); |
| 103 | 103 | $endObj = new DateTime($end); |
| 104 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
| 104 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
| 105 | 105 | $grandSum = 0; |
| 106 | 106 | |
| 107 | 107 | // Generate array of date labels |
@@ -111,17 +111,17 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | foreach ($data as $entry) { |
| 113 | 113 | if (!isset($totals[$entry['tool']])) { |
| 114 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
| 114 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
| 115 | 115 | |
| 116 | 116 | // Create arrays for each tool, filled with zeros for each date in the timeline |
| 117 | 117 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
| 118 | 118 | } else { |
| 119 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
| 119 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $date = new DateTime($entry['date']); |
| 123 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
| 124 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
| 123 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
| 124 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
| 125 | 125 | |
| 126 | 126 | $grandSum += $entry['count']; |
| 127 | 127 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $timeline = []; |
| 160 | 160 | $startObj = new DateTime($start); |
| 161 | 161 | $endObj = new DateTime($end); |
| 162 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
| 162 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
| 163 | 163 | $grandSum = 0; |
| 164 | 164 | |
| 165 | 165 | // Generate array of date labels |
@@ -169,17 +169,17 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | foreach ($data as $entry) { |
| 171 | 171 | if (!isset($totals[$entry['endpoint']])) { |
| 172 | - $totals[$entry['endpoint']] = (int) $entry['count']; |
|
| 172 | + $totals[$entry['endpoint']] = (int)$entry['count']; |
|
| 173 | 173 | |
| 174 | 174 | // Create arrays for each endpoint, filled with zeros for each date in the timeline |
| 175 | 175 | $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0); |
| 176 | 176 | } else { |
| 177 | - $totals[$entry['endpoint']] += (int) $entry['count']; |
|
| 177 | + $totals[$entry['endpoint']] += (int)$entry['count']; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $date = new DateTime($entry['date']); |
| 181 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
| 182 | - $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count']; |
|
| 181 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
| 182 | + $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count']; |
|
| 183 | 183 | |
| 184 | 184 | $grandSum += $entry['count']; |
| 185 | 185 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | /** @var Connection $conn */ |
| 233 | 233 | $conn = $this->container->get('doctrine')->getManager('default')->getConnection(); |
| 234 | - $date = date('Y-m-d'); |
|
| 234 | + $date = date('Y-m-d'); |
|
| 235 | 235 | |
| 236 | 236 | // Tool name needs to be lowercase. |
| 237 | 237 | $tool = strtolower($tool); |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | // Construct the page name |
| 114 | 114 | if (!isset($this->getParameter('rfx')[$domain]['pages'][$type])) { |
| 115 | - $pageTitle= ''; |
|
| 115 | + $pageTitle = ''; |
|
| 116 | 116 | } else { |
| 117 | - $pageTitle= $this->getParameter('rfx')[$domain]['pages'][$type]; |
|
| 117 | + $pageTitle = $this->getParameter('rfx')[$domain]['pages'][$type]; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $pageTitle.= '/'.$this->user->getUsername(); |
|
| 120 | + $pageTitle .= '/'.$this->user->getUsername(); |
|
| 121 | 121 | $page = new Page($this->project, $pageTitle); |
| 122 | 122 | $pageRepo = new PageRepository(); |
| 123 | 123 | $pageRepo->setContainer($this->container); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $neutral = $rfx->getSection('neutral'); |
| 146 | 146 | $dup = $rfx->getDuplicates(); |
| 147 | 147 | |
| 148 | - $total = count($support) + count($oppose) + count($neutral); |
|
| 148 | + $total = count($support)+count($oppose)+count($neutral); |
|
| 149 | 149 | |
| 150 | 150 | if (0 === $total) { |
| 151 | 151 | $this->addFlashMessage('notice', 'no-result', [$pageTitle]); |
@@ -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\Controller; |
| 5 | 5 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $this->project = $defaultProject; |
| 192 | 192 | |
| 193 | 193 | $results = $globalContribs->globalEdits(); |
| 194 | - $results = array_map(function (Edit $edit) { |
|
| 194 | + $results = array_map(function(Edit $edit) { |
|
| 195 | 195 | return $edit->getForJson(true, true); |
| 196 | 196 | }, array_values($results)); |
| 197 | 197 | $results = $this->addFullPageTitlesAndContinue('globalcontribs', [], $results); |
@@ -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 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if ($this->container->hasParameter("database_meta_table")) { |
| 132 | - $table = $this->container->getParameter('database_meta_name') . '.' . |
|
| 132 | + $table = $this->container->getParameter('database_meta_name').'.'. |
|
| 133 | 133 | $this->container->getParameter('database_meta_table'); |
| 134 | 134 | } else { |
| 135 | 135 | $table = "meta_p.wiki"; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | || $projMetadata['url'] == "https://$project" |
| 179 | 179 | || $projMetadata['url'] == "https://$project.org" |
| 180 | 180 | || $projMetadata['url'] == "https://www.$project") { |
| 181 | - $this->logger->debug(__METHOD__ . " Using cached data for $project"); |
|
| 181 | + $this->logger->debug(__METHOD__." Using cached data for $project"); |
|
| 182 | 182 | return $projMetadata; |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $optedIn = $this->container->getParameter('opted_in'); |
| 328 | 328 | // In case there's just one given. |
| 329 | 329 | if (!is_array($optedIn)) { |
| 330 | - $optedIn = [ $optedIn ]; |
|
| 330 | + $optedIn = [$optedIn]; |
|
| 331 | 331 | } |
| 332 | 332 | return $optedIn; |
| 333 | 333 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | ]])->getBody()->getContents(), true); |
| 380 | 380 | |
| 381 | 381 | $extensions = $res['query']['extensions'] ?? []; |
| 382 | - return array_map(function ($extension) { |
|
| 382 | + return array_map(function($extension) { |
|
| 383 | 383 | return $extension['name']; |
| 384 | 384 | }, $extensions); |
| 385 | 385 | } |
@@ -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,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,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 = []; |