Completed
Push — master ( fceba8...c3837b )
by Sam
02:55
created
src/Xtools/Page.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
         $wikidataInfo = $this->getRepository()->getWikidataInfo($this);
329 329
 
330
-        $terms = array_map(function ($entry) {
330
+        $terms = array_map(function($entry) {
331 331
             return $entry['term'];
332 332
         }, $wikidataInfo);
333 333
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                 'prio' => 2,
339 339
                 'name' => 'Wikidata',
340 340
                 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n
341
-                'explanation' => "See: <a target='_blank' " .
341
+                'explanation' => "See: <a target='_blank' ".
342 342
                     "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>",
343 343
             ];
344 344
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                 'prio' => 3,
349 349
                 'name' => 'Wikidata',
350 350
                 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n
351
-                'explanation' => "See: <a target='_blank' " .
351
+                'explanation' => "See: <a target='_blank' ".
352 352
                     "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>",
353 353
             ];
354 354
         }
Please login to merge, or discard this patch.
src/AppBundle/Controller/ArticleInfoController.php 1 patch
Spacing   +21 added lines, -21 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 == '') {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $this->pageInfo['firstEdit'] = new Edit($this->pageInfo['page'], $this->pageHistory[0]);
150 150
         $this->pageInfo['lastEdit'] = new Edit(
151 151
             $this->pageInfo['page'],
152
-            $this->pageHistory[$page->getNumRevisions() - 1]
152
+            $this->pageHistory[$page->getNumRevisions()-1]
153 153
         );
154 154
 
155 155
         // NOTE: bots are fetched first in case we want to restrict some stats to humans editors only
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
         $userGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_groups');
199 199
         $userFromerGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_former_groups');
200 200
         $query = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current
201
-                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision') . "
201
+                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision')."
202 202
                   LEFT JOIN $userGroupsTable ON rev_user = ug_user
203 203
                   LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user
204
-                  WHERE rev_page = " . $this->pageInfo['page']->getId() . " AND (ug_group = 'bot' OR ufg_group = 'bot')
204
+                  WHERE rev_page = ".$this->pageInfo['page']->getId()." AND (ug_group = 'bot' OR ufg_group = 'bot')
205 205
                   GROUP BY rev_user_text";
206 206
         $res = $this->conn->query($query)->fetchAll();
207 207
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
         $sum = 0;
211 211
         foreach ($res as $bot) {
212 212
             $bots[$bot['username']] = [
213
-                'count' => (int) $bot['count'],
213
+                'count' => (int)$bot['count'],
214 214
                 'current' => $bot['current'] === 'bot'
215 215
             ];
216 216
             $sum += $bot['count'];
217 217
         }
218 218
 
219
-        uasort($bots, function ($a, $b) {
220
-            return $b['count'] - $a['count'];
219
+        uasort($bots, function($a, $b) {
220
+            return $b['count']-$a['count'];
221 221
         });
222 222
 
223 223
         $this->pageInfo['general']['bot_revision_count'] = $sum;
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 
266 266
             if ($info['all'] > 1) {
267 267
                 // Number of seconds between first and last edit
268
-                $secs = intval(strtotime($info['last']) - strtotime($info['first']) / $info['all']);
268
+                $secs = intval(strtotime($info['last'])-strtotime($info['first']) / $info['all']);
269 269
 
270 270
                 // Average time between edits (in days)
271
-                $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 );
271
+                $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24);
272 272
             }
273 273
 
274 274
             if (count($info['sizes'])) {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         // First sort editors array by the amount of text they added
285 285
         $topTenEditorsByAdded = $this->pageInfo['editors'];
286
-        uasort($topTenEditorsByAdded, function ($a, $b) {
286
+        uasort($topTenEditorsByAdded, function($a, $b) {
287 287
             if ($a['added'] === $b['added']) {
288 288
                 return 0;
289 289
             }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
         // Then build a new array of top 10 editors by added text,
294 294
         //   in the data structure needed for the chart
295
-        $this->pageInfo['topTenEditorsByAdded'] = array_map(function ($editor) {
295
+        $this->pageInfo['topTenEditorsByAdded'] = array_map(function($editor) {
296 296
             $added = $this->pageInfo['editors'][$editor]['added'];
297 297
             return [
298 298
                 'label' => $editor,
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
         // Transform to associative array by 'type'
341 341
         foreach ($res as $row) {
342
-            $data[$row['type'] . '_count'] = $row['value'];
342
+            $data[$row['type'].'_count'] = $row['value'];
343 343
         }
344 344
 
345 345
         return $data;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $title = str_replace(' ', '_', $this->pageInfo['page']->getTitle());
356 356
         $query = "SELECT log_action, log_type, log_timestamp AS timestamp
357 357
                   FROM $loggingTable
358
-                  WHERE log_namespace = '" . $this->pageInfo['page']->getNamespace() . "'
358
+                  WHERE log_namespace = '".$this->pageInfo['page']->getNamespace()."'
359 359
                   AND log_title = '$title' AND log_timestamp > 1
360 360
                   AND log_type IN ('delete', 'move', 'protect', 'stable')";
361 361
         $events = $this->conn->query($query)->fetchAll();
@@ -407,14 +407,14 @@  discard block
 block discarded – undo
407 407
             return $rev['length'];
408 408
         }
409 409
 
410
-        $lastRev = $this->pageHistory[$revIndex - 1];
410
+        $lastRev = $this->pageHistory[$revIndex-1];
411 411
 
412 412
         // TODO: Remove once T101631 is resolved
413 413
         // Treat as zero change in size if length of previous edit is missing
414 414
         if ($lastRev['length'] === null) {
415 415
             return 0;
416 416
         } else {
417
-            return $rev['length'] - $lastRev['length'];
417
+            return $rev['length']-$lastRev['length'];
418 418
         }
419 419
     }
420 420
 
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 
435 435
         // Get UNIX timestamp of the first day of the month of the first edit
436 436
         // This is used as a comparison when building our array of per-month stats
437
-        $firstEditMonth = mktime(0, 0, 0, (int) $firstEdit->getMonth(), 1, $firstEdit->getYear());
437
+        $firstEditMonth = mktime(0, 0, 0, (int)$firstEdit->getMonth(), 1, $firstEdit->getYear());
438 438
 
439 439
         $lastEdit = $this->pageInfo['lastEdit'];
440
-        $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[ $revisionCount - 2 ];
440
+        $secondLastEdit = $revisionCount === 1 ? $lastEdit : $this->pageHistory[$revisionCount-2];
441 441
 
442 442
         // Now we can start our master array. This one will be HUGE!
443 443
         $data = [
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             // Increment year and month counts for all edits
509 509
             $data['year_count'][$edit->getYear()]['all']++;
510 510
             $data['year_count'][$edit->getYear()]['months'][$edit->getMonth()]['all']++;
511
-            $data['year_count'][$edit->getYear()]['size'] = (int) $rev['length'];
511
+            $data['year_count'][$edit->getYear()]['size'] = (int)$rev['length'];
512 512
 
513 513
             $editsThisMonth = $data['year_count'][$edit->getYear()]['months'][$edit->getMonth()]['all'];
514 514
             if ($editsThisMonth > $data['max_edits_per_month']) {
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
                 }
553 553
 
554 554
                 // determine if the next revision was a revert
555
-                $nextRevision = isset($this->pageHistory[$i + 1]) ? $this->pageHistory[$i + 1] : null;
555
+                $nextRevision = isset($this->pageHistory[$i+1]) ? $this->pageHistory[$i+1] : null;
556 556
                 $nextRevisionIsRevert = $nextRevision &&
557
-                    $this->getDiffSize($i + 1) === -$edit->getSize() &&
557
+                    $this->getDiffSize($i+1) === -$edit->getSize() &&
558 558
                     $this->aeh->isRevert($nextRevision['comment']);
559 559
 
560 560
                 // don't count this edit as content removal if the next edit reverted it
Please login to merge, or discard this patch.