Completed
Push — master ( acb1d3...68d8ad )
by MusikAnimal
02:16
created
src/AppBundle/Controller/ArticleInfoController.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
         $article = $request->query->get('article');
81 81
 
82 82
         if ($projectQuery != '' && $article != '') {
83
-            return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]);
83
+            return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]);
84 84
         } elseif ($article != '') {
85
-            return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]);
85
+            return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]);
86 86
         }
87 87
 
88 88
         if ($projectQuery == '') {
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
             $rendered = str_replace('"', '\"', trim($rendered));
121 121
 
122 122
             // Uglify temporary file.
123
-            $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js';
123
+            $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js';
124 124
             $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && ";
125
-            $script .= $this->get('kernel')->getRootDir() .
126
-                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " .
125
+            $script .= $this->get('kernel')->getRootDir().
126
+                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ".
127 127
                 "&& rm $tmpFile >/dev/null";
128 128
             $process = new Process($script);
129 129
             $process->run();
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
             $rendered = str_replace('\"', '"', trim($rendered));
143 143
 
144 144
             // Add comment after uglifying since it removes comments.
145
-            $rendered = "/**\n * This code was automatically generated and should not " .
146
-                "be manually edited.\n * For updates, please copy and paste from " .
147
-                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) .
148
-                "\n * Released under GPL v3 license.\n */\n" . $rendered;
145
+            $rendered = "/**\n * This code was automatically generated and should not ".
146
+                "be manually edited.\n * For updates, please copy and paste from ".
147
+                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL).
148
+                "\n * Released under GPL v3 license.\n */\n".$rendered;
149 149
         }
150 150
 
151 151
         $response = new \Symfony\Component\HttpFoundation\Response($rendered);
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
         $userGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_groups');
247 247
         $userFromerGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_former_groups');
248 248
         $query = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current
249
-                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision') . "
249
+                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision')."
250 250
                   LEFT JOIN $userGroupsTable ON rev_user = ug_user
251 251
                   LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user
252
-                  WHERE rev_page = " . $this->pageInfo['page']->getId() . " AND (ug_group = 'bot' OR ufg_group = 'bot')
252
+                  WHERE rev_page = ".$this->pageInfo['page']->getId()." AND (ug_group = 'bot' OR ufg_group = 'bot')
253 253
                   GROUP BY rev_user_text";
254 254
         $res = $this->conn->query($query)->fetchAll();
255 255
 
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
         $sum = 0;
259 259
         foreach ($res as $bot) {
260 260
             $bots[$bot['username']] = [
261
-                'count' => (int) $bot['count'],
261
+                'count' => (int)$bot['count'],
262 262
                 'current' => $bot['current'] === 'bot'
263 263
             ];
264 264
             $sum += $bot['count'];
265 265
         }
266 266
 
267
-        uasort($bots, function ($a, $b) {
268
-            return $b['count'] - $a['count'];
267
+        uasort($bots, function($a, $b) {
268
+            return $b['count']-$a['count'];
269 269
         });
270 270
 
271 271
         $this->pageInfo['general']['bot_revision_count'] = $sum;
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 
314 314
             if ($info['all'] > 1) {
315 315
                 // Number of seconds/days between first and last edit
316
-                $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp();
317
-                $days = $secs / ( 60 * 60 * 24 );
316
+                $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp();
317
+                $days = $secs / (60 * 60 * 24);
318 318
 
319 319
                 // Average time between edits (in days)
320 320
                 $this->pageInfo['editors'][$editor]['atbe'] = $days / $info['all'];
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
         // First sort editors array by the amount of text they added
334 334
         $topTenEditorsByAdded = $this->pageInfo['editors'];
335
-        uasort($topTenEditorsByAdded, function ($a, $b) {
335
+        uasort($topTenEditorsByAdded, function($a, $b) {
336 336
             if ($a['added'] === $b['added']) {
337 337
                 return 0;
338 338
             }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
         // Then build a new array of top 10 editors by added text,
343 343
         //   in the data structure needed for the chart
344
-        $this->pageInfo['topTenEditorsByAdded'] = array_map(function ($editor) {
344
+        $this->pageInfo['topTenEditorsByAdded'] = array_map(function($editor) {
345 345
             $added = $this->pageInfo['editors'][$editor]['added'];
346 346
             return [
347 347
                 'label' => $editor,
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         $title = str_replace(' ', '_', $page->getTitle());
367 367
         $sql = "SELECT log_action, log_type, log_timestamp AS timestamp
368 368
                 FROM $loggingTable
369
-                WHERE log_namespace = '" . $page->getNamespace() . "'
369
+                WHERE log_namespace = '".$page->getNamespace()."'
370 370
                 AND log_title = :title AND log_timestamp > 1
371 371
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
372 372
         $resultQuery = $this->conn->prepare($sql);
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 
492 492
             if ($revCount === 0) {
493 493
                 $firstEdit = $edit;
494
-                $firstEditMonth = mktime(0, 0, 0, (int) $firstEdit->getMonth(), 1, $firstEdit->getYear());
494
+                $firstEditMonth = mktime(0, 0, 0, (int)$firstEdit->getMonth(), 1, $firstEdit->getYear());
495 495
             }
496 496
 
497 497
             $username = $edit->getUser()->getUsername();
Please login to merge, or discard this patch.