Completed
Pull Request — master (#90)
by MusikAnimal
03:20
created
src/AppBundle/Controller/ArticleInfoController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
         $article = $request->query->get('article');
80 80
 
81 81
         if ($projectQuery != '' && $article != '') {
82
-            return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]);
82
+            return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]);
83 83
         } elseif ($article != '') {
84
-            return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]);
84
+            return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]);
85 85
         }
86 86
 
87 87
         if ($projectQuery == '') {
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
             $rendered = str_replace('$', '\$', trim($rendered));
116 116
             $rendered = str_replace('"', '\"', trim($rendered));
117 117
             $script = "echo \"$rendered\" | tee temp.js >/dev/null && ";
118
-            $script .= $this->get('kernel')->getRootDir() .
118
+            $script .= $this->get('kernel')->getRootDir().
119 119
                 '/Resources/node_modules/uglify-es/bin/uglifyjs temp.js --mangle';
120
-            $script .=  '&& rm temp.js >/dev/null';
120
+            $script .= '&& rm temp.js >/dev/null';
121 121
             $process = new Process($script);
122 122
             $process->run();
123 123
             $rendered = str_replace('\$', '$', trim($process->getOutput()));
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
         $userGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_groups');
222 222
         $userFromerGroupsTable = $this->projectRepo->getTableName($this->dbName, 'user_former_groups');
223 223
         $query = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current
224
-                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision') . "
224
+                  FROM " . $this->projectRepo->getTableName($this->dbName, 'revision')."
225 225
                   LEFT JOIN $userGroupsTable ON rev_user = ug_user
226 226
                   LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user
227
-                  WHERE rev_page = " . $this->pageInfo['page']->getId() . " AND (ug_group = 'bot' OR ufg_group = 'bot')
227
+                  WHERE rev_page = ".$this->pageInfo['page']->getId()." AND (ug_group = 'bot' OR ufg_group = 'bot')
228 228
                   GROUP BY rev_user_text";
229 229
         $res = $this->conn->query($query)->fetchAll();
230 230
 
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
         $sum = 0;
234 234
         foreach ($res as $bot) {
235 235
             $bots[$bot['username']] = [
236
-                'count' => (int) $bot['count'],
236
+                'count' => (int)$bot['count'],
237 237
                 'current' => $bot['current'] === 'bot'
238 238
             ];
239 239
             $sum += $bot['count'];
240 240
         }
241 241
 
242
-        uasort($bots, function ($a, $b) {
243
-            return $b['count'] - $a['count'];
242
+        uasort($bots, function($a, $b) {
243
+            return $b['count']-$a['count'];
244 244
         });
245 245
 
246 246
         $this->pageInfo['general']['bot_revision_count'] = $sum;
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 
289 289
             if ($info['all'] > 1) {
290 290
                 // Number of seconds between first and last edit
291
-                $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp();
291
+                $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp();
292 292
 
293 293
                 // Average time between edits (in days)
294
-                $this->pageInfo['editors'][$editor]['atbe'] = $secs / ( 60 * 60 * 24 );
294
+                $this->pageInfo['editors'][$editor]['atbe'] = $secs / (60 * 60 * 24);
295 295
             }
296 296
 
297 297
             if (count($info['sizes'])) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
         // First sort editors array by the amount of text they added
308 308
         $topTenEditorsByAdded = $this->pageInfo['editors'];
309
-        uasort($topTenEditorsByAdded, function ($a, $b) {
309
+        uasort($topTenEditorsByAdded, function($a, $b) {
310 310
             if ($a['added'] === $b['added']) {
311 311
                 return 0;
312 312
             }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
         // Then build a new array of top 10 editors by added text,
317 317
         //   in the data structure needed for the chart
318
-        $this->pageInfo['topTenEditorsByAdded'] = array_map(function ($editor) {
318
+        $this->pageInfo['topTenEditorsByAdded'] = array_map(function($editor) {
319 319
             $added = $this->pageInfo['editors'][$editor]['added'];
320 320
             return [
321 321
                 'label' => $editor,
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         $title = str_replace(' ', '_', $page->getTitle());
341 341
         $sql = "SELECT log_action, log_type, log_timestamp AS timestamp
342 342
                 FROM $loggingTable
343
-                WHERE log_namespace = '" . $page->getNamespace() . "'
343
+                WHERE log_namespace = '".$page->getNamespace()."'
344 344
                 AND log_title = :title AND log_timestamp > 1
345 345
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
346 346
         $resultQuery = $this->conn->prepare($sql);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
             if ($revCount === 0) {
467 467
                 $firstEdit = $edit;
468
-                $firstEditMonth = mktime(0, 0, 0, (int) $firstEdit->getMonth(), 1, $firstEdit->getYear());
468
+                $firstEditMonth = mktime(0, 0, 0, (int)$firstEdit->getMonth(), 1, $firstEdit->getYear());
469 469
             }
470 470
 
471 471
             $username = $edit->getUser()->getUsername();
Please login to merge, or discard this patch.