@@ -166,7 +166,7 @@ |
||
| 166 | 166 | $neutral = $rfx->getSection('neutral'); |
| 167 | 167 | $dup = $rfx->getDuplicates(); |
| 168 | 168 | |
| 169 | - $total = count($support) + count($oppose) + count($neutral); |
|
| 169 | + $total = count($support)+count($oppose)+count($neutral); |
|
| 170 | 170 | |
| 171 | 171 | if ($total === 0) { |
| 172 | 172 | $this->addFlash('notice', ['no-result', $pagename]); |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | $isSubRequest = $this->container->get('request_stack')->getParentRequest() !== null; |
| 137 | 137 | |
| 138 | 138 | return $this->render('editCounter/result.html.twig', [ |
| 139 | - 'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(), |
|
| 139 | + 'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(), |
|
| 140 | 140 | 'xtPage' => 'ec', |
| 141 | 141 | 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'), |
| 142 | 142 | 'is_sub_request' => $isSubRequest, |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Find the path, and complain if English doesn't exist. |
| 60 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
| 60 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
| 61 | 61 | if (!file_exists("$path/en.json")) { |
| 62 | 62 | throw new Exception("Language directory doesn't exist: $path"); |
| 63 | 63 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return $this->editCounts[$domain]; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $this->editCounts[$domain] = (int) $this->getRepository()->getEditCount( |
|
| 95 | + $this->editCounts[$domain] = (int)$this->getRepository()->getEditCount( |
|
| 96 | 96 | $project->getDatabaseName(), |
| 97 | 97 | $this->getUsername() |
| 98 | 98 | ); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function isAnon() |
| 160 | 160 | { |
| 161 | - return (bool) filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 161 | + return (bool)filter_var($this->username, FILTER_VALIDATE_IP); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function countEdits(Project $project, $namespace = 'all', $start = '', $end = '') |
| 222 | 222 | { |
| 223 | - return (int) $this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 223 | + return (int)$this->getRepository()->countEdits($project, $this, $namespace, $start, $end); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function countAutomatedEdits(Project $project, $namespace = 'all', $start = '', $end = '') |
| 235 | 235 | { |
| 236 | - return (int) $this->getRepository()->countAutomatedEdits($project, $this, $namespace, $start, $end); |
|
| 236 | + return (int)$this->getRepository()->countAutomatedEdits($project, $this, $namespace, $start, $end); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | $namespaces = $project->getNamespaces(); |
| 267 | 267 | |
| 268 | - return array_map(function ($rev) use ($namespaces) { |
|
| 268 | + return array_map(function($rev) use ($namespaces) { |
|
| 269 | 269 | $pageTitle = $rev['page_title']; |
| 270 | 270 | $fullPageTitle = ''; |
| 271 | 271 | |
| 272 | 272 | if ($rev['page_namespace'] !== '0') { |
| 273 | - $fullPageTitle = $namespaces[$rev['page_namespace']] . ":$pageTitle"; |
|
| 273 | + $fullPageTitle = $namespaces[$rev['page_namespace']].":$pageTitle"; |
|
| 274 | 274 | } else { |
| 275 | 275 | $fullPageTitle = $pageTitle; |
| 276 | 276 | } |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | return [ |
| 279 | 279 | 'full_page_title' => $fullPageTitle, |
| 280 | 280 | 'page_title' => $pageTitle, |
| 281 | - 'page_namespace' => (int) $rev['page_namespace'], |
|
| 282 | - 'rev_id' => (int) $rev['rev_id'], |
|
| 281 | + 'page_namespace' => (int)$rev['page_namespace'], |
|
| 282 | + 'rev_id' => (int)$rev['rev_id'], |
|
| 283 | 283 | 'timestamp' => DateTime::createFromFormat('YmdHis', $rev['timestamp']), |
| 284 | - 'minor' => (bool) $rev['minor'], |
|
| 285 | - 'length' => (int) $rev['length'], |
|
| 286 | - 'length_change' => (int) $rev['length_change'], |
|
| 284 | + 'minor' => (bool)$rev['minor'], |
|
| 285 | + 'length' => (int)$rev['length'], |
|
| 286 | + 'length_change' => (int)$rev['length_change'], |
|
| 287 | 287 | 'comment' => $rev['comment'], |
| 288 | 288 | ]; |
| 289 | 289 | }, $revs); |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | $displayTitles = $this->getDisplayTitles($pages); |
| 120 | 120 | |
| 121 | 121 | foreach ($pages as $page) { |
| 122 | - $nsId = (int) $page['page_namespace']; |
|
| 123 | - $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']] . ':' : ''; |
|
| 124 | - $pageTitle = $nsTitle . $page['page_title']; |
|
| 122 | + $nsId = (int)$page['page_namespace']; |
|
| 123 | + $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']].':' : ''; |
|
| 124 | + $pageTitle = $nsTitle.$page['page_title']; |
|
| 125 | 125 | $page['displaytitle'] = $displayTitles[$pageTitle]; |
| 126 | 126 | |
| 127 | 127 | // $page['page_title'] is retained without the namespace |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | $namespaces = $this->project->getNamespaces(); |
| 149 | 149 | |
| 150 | 150 | // First extract page titles including namespace. |
| 151 | - $pageTitles = array_map(function ($page) use ($namespaces) { |
|
| 151 | + $pageTitles = array_map(function($page) use ($namespaces) { |
|
| 152 | 152 | // If non-mainspace, prepend namespace to the titles. |
| 153 | 153 | $ns = $page['page_namespace']; |
| 154 | - $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']] . ':' : ''; |
|
| 155 | - return $nsTitle . $page['page_title']; |
|
| 154 | + $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']].':' : ''; |
|
| 155 | + return $nsTitle.$page['page_title']; |
|
| 156 | 156 | }, $topPages); |
| 157 | 157 | |
| 158 | 158 | return $this->getRepository()->getDisplayTitles($this->project, $pageTitles); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments() && $namespace === 0; |
| 39 | 39 | $paSelect = $hasPageAssessments |
| 40 | - ? ", ( |
|
| 40 | + ? ", ( |
|
| 41 | 41 | SELECT pa_class |
| 42 | 42 | FROM page_assessments |
| 43 | 43 | WHERE pa_page_id = page_id |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments(); |
| 93 | 93 | $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments'); |
| 94 | 94 | $paSelect = $hasPageAssessments |
| 95 | - ? ", ( |
|
| 95 | + ? ", ( |
|
| 96 | 96 | SELECT pa_class |
| 97 | 97 | FROM $pageAssessmentsTable |
| 98 | 98 | WHERE pa_page_id = e.page_id |
@@ -191,7 +191,7 @@ |
||
| 191 | 191 | // Send all to the template. |
| 192 | 192 | return $this->render('topedits/result_article.html.twig', [ |
| 193 | 193 | 'xtPage' => 'topedits', |
| 194 | - 'xtTitle' => $user->getUsername() . ' - ' . $page->getTitle(), |
|
| 194 | + 'xtTitle' => $user->getUsername().' - '.$page->getTitle(), |
|
| 195 | 195 | 'project' => $project, |
| 196 | 196 | 'user' => $user, |
| 197 | 197 | 'page' => $page, |
@@ -132,16 +132,16 @@ discard block |
||
| 132 | 132 | $rev = $row['value']; |
| 133 | 133 | } |
| 134 | 134 | if ($row['source'] == 'groups') { |
| 135 | - $groups .= $row['value']. ', '; |
|
| 135 | + $groups .= $row['value'].', '; |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Unknown user - If the user is created the $results variable will have 3 entries. |
| 140 | 140 | // This is a workaround to detect non-existent IPs. |
| 141 | 141 | if (count($results) < 3 && $arch == 0 && $rev == 0) { |
| 142 | - $this->addFlash('notice', [ 'no-result', $username]); |
|
| 142 | + $this->addFlash('notice', ['no-result', $username]); |
|
| 143 | 143 | |
| 144 | - return $this->redirectToRoute('SimpleEditCounterProject', [ 'project' => $project->getDomain() ]); |
|
| 144 | + return $this->redirectToRoute('SimpleEditCounterProject', ['project' => $project->getDomain()]); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Remove the last comma and space |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | 'project' => $project, |
| 171 | 171 | 'id' => $id, |
| 172 | 172 | 'arch' => $arch, |
| 173 | - 'rev' => $rev + $arch, |
|
| 173 | + 'rev' => $rev+$arch, |
|
| 174 | 174 | 'live' => $rev, |
| 175 | 175 | 'groups' => $groups, |
| 176 | 176 | 'globalGroups' => $globalGroups, |
@@ -91,20 +91,20 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | // MULTIPLIERS (to review) |
| 93 | 93 | $multipliers = [ |
| 94 | - 'account-age-mult' => 1.25, # 0 if = 365 jours |
|
| 95 | - 'edit-count-mult' => 1.25, # 0 if = 10 000 |
|
| 96 | - 'user-page-mult' => 0.1, # 0 if = |
|
| 97 | - 'patrols-mult' => 1, # 0 if = |
|
| 98 | - 'blocks-mult' => 1.4, # 0 if = 10 |
|
| 94 | + 'account-age-mult' => 1.25, # 0 if = 365 jours |
|
| 95 | + 'edit-count-mult' => 1.25, # 0 if = 10 000 |
|
| 96 | + 'user-page-mult' => 0.1, # 0 if = |
|
| 97 | + 'patrols-mult' => 1, # 0 if = |
|
| 98 | + 'blocks-mult' => 1.4, # 0 if = 10 |
|
| 99 | 99 | 'afd-mult' => 1.15, |
| 100 | - 'recent-activity-mult' => 0.9, # 0 if = |
|
| 100 | + 'recent-activity-mult' => 0.9, # 0 if = |
|
| 101 | 101 | 'aiv-mult' => 1.15, |
| 102 | - 'edit-summaries-mult' => 0.8, # 0 if = |
|
| 103 | - 'namespaces-mult' => 1.0, # 0 if = |
|
| 104 | - 'pages-created-live-mult' => 1.4, # 0 if = |
|
| 105 | - 'pages-created-deleted-mult' => 1.4, # 0 if = |
|
| 106 | - 'rpp-mult' => 1.15, # 0 if = |
|
| 107 | - 'user-rights-mult' => 0.75, # 0 if = |
|
| 102 | + 'edit-summaries-mult' => 0.8, # 0 if = |
|
| 103 | + 'namespaces-mult' => 1.0, # 0 if = |
|
| 104 | + 'pages-created-live-mult' => 1.4, # 0 if = |
|
| 105 | + 'pages-created-deleted-mult' => 1.4, # 0 if = |
|
| 106 | + 'rpp-mult' => 1.15, # 0 if = |
|
| 107 | + 'user-rights-mult' => 0.75, # 0 if = |
|
| 108 | 108 | ]; |
| 109 | 109 | |
| 110 | 110 | // Grab the connection to the replica database (which is separate from the above) |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | $now = new DateTime(); |
| 183 | 183 | $date = new DateTime($value); |
| 184 | 184 | $diff = $date->diff($now); |
| 185 | - $formula = 365 * $diff->format('%y') + 30 * $diff->format('%m') + $diff->format('%d'); |
|
| 186 | - $value = $formula - 365; |
|
| 185 | + $formula = 365 * $diff->format('%y')+30 * $diff->format('%m')+$diff->format('%d'); |
|
| 186 | + $value = $formula-365; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $multiplierKey = $row['source'] . '-mult'; |
|
| 189 | + $multiplierKey = $row['source'].'-mult'; |
|
| 190 | 190 | $multiplier = isset($multipliers[$multiplierKey]) ? $multipliers[$multiplierKey] : 1; |
| 191 | 191 | $score = max(min($value * $multiplier, 100), -100); |
| 192 | 192 | $master[$key]['mult'] = $multiplier; |