Completed
Push — master ( d2fbc7...16b0bc )
by Sam
02:55
created
src/Xtools/Repository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
         // $tableExtension in order to generate the new table name
151 151
         if ($this->isLabs() && $tableExtension !== null) {
152 152
             $mapped = true;
153
-            $tableName = $tableName . '_' . $tableExtension;
153
+            $tableName = $tableName.'_'.$tableExtension;
154 154
         } elseif ($this->container->hasParameter("app.table.$tableName")) {
155 155
             // Use the table specified in the table mapping configuration, if present.
156 156
             $mapped = true;
Please login to merge, or discard this patch.
src/AppBundle/Controller/ArticleInfoController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
         $article = $request->query->get('article');
84 84
 
85 85
         if ($projectQuery != '' && $article != '') {
86
-            return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]);
86
+            return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]);
87 87
         } elseif ($article != '') {
88
-            return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]);
88
+            return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]);
89 89
         }
90 90
 
91 91
         if ($projectQuery == '') {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $this->pageInfo['firstEdit'] = new Edit($this->pageInfo['page'], $this->pageHistory[0]);
154 154
         $this->pageInfo['lastEdit'] = new Edit(
155 155
             $this->pageInfo['page'],
156
-            $this->pageHistory[$page->getNumRevisions() - 1]
156
+            $this->pageHistory[$page->getNumRevisions()-1]
157 157
         );
158 158
 
159 159
         // NOTE: bots are fetched first in case we want to restrict some stats to humans editors only
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
         $userGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_groups');
216 216
         $userFromerGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_former_groups');
217 217
         $query = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current
218
-                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision') . "
218
+                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision')."
219 219
                   LEFT JOIN $userGroupsTable ON rev_user = ug_user
220 220
                   LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user
221
-                  WHERE rev_page = " . $this->pageInfo['page']->getId() . " AND (ug_group = 'bot' OR ufg_group = 'bot')
221
+                  WHERE rev_page = ".$this->pageInfo['page']->getId()." AND (ug_group = 'bot' OR ufg_group = 'bot')
222 222
                   GROUP BY rev_user_text";
223 223
         $res = $this->conn->query($query)->fetchAll();
224 224
 
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
         $sum = 0;
228 228
         foreach ($res as $bot) {
229 229
             $bots[$bot['username']] = [
230
-                'count' => (int) $bot['count'],
230
+                'count' => (int)$bot['count'],
231 231
                 'current' => $bot['current'] === 'bot'
232 232
             ];
233 233
             $sum += $bot['count'];
234 234
         }
235 235
 
236
-        uasort($bots, function ($a, $b) {
237
-            return $b['count'] - $a['count'];
236
+        uasort($bots, function($a, $b) {
237
+            return $b['count']-$a['count'];
238 238
         });
239 239
 
240 240
         $this->pageInfo['general']['bot_revision_count'] = $sum;
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
 
283 283
             if ($info['all'] > 1) {
284 284
                 // Number of seconds between first and last edit
285
-                $secs = intval(strtotime($info['last']) - strtotime($info['first']) / $info['all']);
285
+                $secs = intval(strtotime($info['last'])-strtotime($info['first']) / $info['all']);
286 286
 
287 287
                 // Average time between edits (in days)
288
-                $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 );
288
+                $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24);
289 289
             }
290 290
 
291 291
             if (count($info['sizes'])) {
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
         // First sort editors array by the amount of text they added
302 302
         $topTenEditorsByAdded = $this->pageInfo['editors'];
303
-        uasort($topTenEditorsByAdded, function ($a, $b) {
303
+        uasort($topTenEditorsByAdded, function($a, $b) {
304 304
             if ($a['added'] === $b['added']) {
305 305
                 return 0;
306 306
             }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
         // Then build a new array of top 10 editors by added text,
311 311
         //   in the data structure needed for the chart
312
-        $this->pageInfo['topTenEditorsByAdded'] = array_map(function ($editor) {
312
+        $this->pageInfo['topTenEditorsByAdded'] = array_map(function($editor) {
313 313
             $added = $this->pageInfo['editors'][$editor]['added'];
314 314
             return [
315 315
                 'label' => $editor,
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
         // Transform to associative array by 'type'
358 358
         foreach ($res as $row) {
359
-            $data[$row['type'] . '_count'] = $row['value'];
359
+            $data[$row['type'].'_count'] = $row['value'];
360 360
         }
361 361
 
362 362
         return $data;
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $title = str_replace(' ', '_', $this->pageInfo['page']->getTitle());
373 373
         $query = "SELECT log_action, log_type, log_timestamp AS timestamp
374 374
                   FROM $loggingTable
375
-                  WHERE log_namespace = '" . $this->pageInfo['page']->getNamespace() . "'
375
+                  WHERE log_namespace = '".$this->pageInfo['page']->getNamespace()."'
376 376
                   AND log_title = '$title' AND log_timestamp > 1
377 377
                   AND log_type IN ('delete', 'move', 'protect', 'stable')";
378 378
         $events = $this->conn->query($query)->fetchAll();
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
         $conn = $this->container->get('doctrine')->getManager('replicas')->getConnection();
472 472
         $res = $conn->query($query)->fetchAll();
473 473
 
474
-        $terms = array_map(function ($entry) {
474
+        $terms = array_map(function($entry) {
475 475
             return $entry['term'];
476 476
         }, $res);
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
                 'prio' => 2,
483 483
                 'name' => 'Wikidata',
484 484
                 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n
485
-                'explanation' => "See: <a target='_blank' " .
485
+                'explanation' => "See: <a target='_blank' ".
486 486
                     "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>",
487 487
             ];
488 488
         }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                 'prio' => 3,
492 492
                 'name' => 'Wikidata',
493 493
                 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n
494
-                'explanation' => "See: <a target='_blank' " .
494
+                'explanation' => "See: <a target='_blank' ".
495 495
                     "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>",
496 496
             ];
497 497
         }
@@ -512,14 +512,14 @@  discard block
 block discarded – undo
512 512
             return $rev['length'];
513 513
         }
514 514
 
515
-        $lastRev = $this->pageHistory[$revIndex - 1];
515
+        $lastRev = $this->pageHistory[$revIndex-1];
516 516
 
517 517
         // TODO: Remove once T101631 is resolved
518 518
         // Treat as zero change in size if length of previous edit is missing
519 519
         if ($lastRev['length'] === null) {
520 520
             return 0;
521 521
         } else {
522
-            return $rev['length'] - $lastRev['length'];
522
+            return $rev['length']-$lastRev['length'];
523 523
         }
524 524
     }
525 525
 
@@ -539,10 +539,10 @@  discard block
 block discarded – undo
539 539
 
540 540
         // Get UNIX timestamp of the first day of the month of the first edit
541 541
         // This is used as a comparison when building our array of per-month stats
542
-        $firstEditMonth = mktime(0, 0, 0, (int) $firstEdit->getMonth(), 1, $firstEdit->getYear());
542
+        $firstEditMonth = mktime(0, 0, 0, (int)$firstEdit->getMonth(), 1, $firstEdit->getYear());
543 543
 
544 544
         $lastEdit = $this->pageInfo['lastEdit'];
545
-        $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[ $revisionCount - 2 ];
545
+        $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[$revisionCount-2];
546 546
 
547 547
         // Now we can start our master array. This one will be HUGE!
548 548
         $data = [
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
             // Increment year and month counts for all edits
614 614
             $data['year_count'][$edit->getYear()]['all']++;
615 615
             $data['year_count'][$edit->getYear()]['months'][$edit->getMonth()]['all']++;
616
-            $data['year_count'][$edit->getYear()]['size'] = (int) $rev['length'];
616
+            $data['year_count'][$edit->getYear()]['size'] = (int)$rev['length'];
617 617
 
618 618
             $editsThisMonth = $data['year_count'][$edit->getYear()]['months'][$edit->getMonth()]['all'];
619 619
             if ($editsThisMonth > $data['max_edits_per_month']) {
@@ -657,9 +657,9 @@  discard block
 block discarded – undo
657 657
                 }
658 658
 
659 659
                 // determine if the next revision was a revert
660
-                $nextRevision = isset($this->pageHistory[$i + 1]) ? $this->pageHistory[$i + 1] : null;
660
+                $nextRevision = isset($this->pageHistory[$i+1]) ? $this->pageHistory[$i+1] : null;
661 661
                 $nextRevisionIsRevert = $nextRevision &&
662
-                    $this->getDiffSize($i + 1) === -$edit->getSize() &&
662
+                    $this->getDiffSize($i+1) === -$edit->getSize() &&
663 663
                     $this->aeh->isRevert($nextRevision['comment']);
664 664
 
665 665
                 // don't count this edit as content removal if the next edit reverted it
Please login to merge, or discard this patch.
src/Xtools/EditCounterRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public function getRevisionCounts(Project $project, User $user)
28 28
     {
29 29
         // Set up cache.
30
-        $cacheKey = 'revisioncounts.' . $project->getDatabaseName() . '.' . $user->getUsername();
30
+        $cacheKey = 'revisioncounts.'.$project->getDatabaseName().'.'.$user->getUsername();
31 31
         if ($this->cache->hasItem($cacheKey)) {
32 32
             return $this->cache->getItem($cacheKey)->get();
33 33
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     public function getRevisionDates(Project $project, User $user)
91 91
     {
92 92
         // Set up cache.
93
-        $cacheKey = 'revisiondates.' . $project->getDatabaseName() . '.' . $user->getUsername();
93
+        $cacheKey = 'revisiondates.'.$project->getDatabaseName().'.'.$user->getUsername();
94 94
         if ($this->cache->hasItem($cacheKey)) {
95 95
             return $this->cache->getItem($cacheKey)->get();
96 96
         }
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
         $results = $resultQuery->fetchAll();
163 163
 
164 164
         $pageCounts = array_combine(
165
-            array_map(function ($e) {
165
+            array_map(function($e) {
166 166
                 return $e['source'];
167 167
             }, $results),
168
-            array_map(function ($e) {
168
+            array_map(function($e) {
169 169
                 return $e['value'];
170 170
             }, $results)
171 171
         );
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
         $resultQuery->execute();
217 217
         $results = $resultQuery->fetchAll();
218 218
         $logCounts = array_combine(
219
-            array_map(function ($e) {
219
+            array_map(function($e) {
220 220
                 return $e['source'];
221 221
             }, $results),
222
-            array_map(function ($e) {
222
+            array_map(function($e) {
223 223
                 return $e['value'];
224 224
             }, $results)
225 225
         );
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
         $resultQuery->bindParam(":id", $userId);
442 442
         $resultQuery->execute();
443 443
         $results = $resultQuery->fetchAll();
444
-        $namespaceTotals = array_combine(array_map(function ($e) {
444
+        $namespaceTotals = array_combine(array_map(function($e) {
445 445
             return $e['page_namespace'];
446
-        }, $results), array_map(function ($e) {
446
+        }, $results), array_map(function($e) {
447 447
             return $e['total'];
448 448
         }, $results));
449 449
 
Please login to merge, or discard this patch.