Completed
Pull Request — master (#115)
by MusikAnimal
02:28
created
src/AppBundle/Controller/ArticleInfoController.php 1 patch
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -8,13 +8,9 @@
 block discarded – undo
8 8
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9 9
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10 10
 use Symfony\Component\HttpFoundation\Request;
11
-use Symfony\Component\DependencyInjection\ContainerInterface;
12 11
 use Symfony\Component\HttpFoundation\Response;
13 12
 use Symfony\Component\Process\Process;
14 13
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
15
-use Xtools\ProjectRepository;
16
-use Xtools\Page;
17
-use Xtools\PagesRepository;
18 14
 use Xtools\ArticleInfo;
19 15
 use Xtools\ArticleInfoRepository;
20 16
 
Please login to merge, or discard this patch.
src/Xtools/ArticleInfoRepository.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     /**
15 15
      * Get the number of edits made to the page by bots or former bots.
16 16
      * @param  Page $page
17
-     * @return PDOStatement resolving with keys 'count', 'username' and 'current'.
17
+     * @return \Doctrine\DBAL\Driver\Statement resolving with keys 'count', 'username' and 'current'.
18 18
      */
19 19
     public function getBotData(Page $page)
20 20
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $userGroupsTable = $project->getTableName('user_groups');
23 23
         $userFromerGroupsTable = $project->getTableName('user_former_groups');
24 24
         $sql = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current
25
-                FROM " . $project->getTableName('revision') . "
25
+                FROM " . $project->getTableName('revision')."
26 26
                 LEFT JOIN $userGroupsTable ON rev_user = ug_user
27 27
                 LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user
28 28
                 WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot')
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $loggingTable = $page->getProject()->getTableName('logging', 'logindex');
45 45
         $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp'
46 46
                 FROM $loggingTable
47
-                WHERE log_namespace = '" . $page->getNamespace() . "'
47
+                WHERE log_namespace = '".$page->getNamespace()."'
48 48
                 AND log_title = :title AND log_timestamp > 1
49 49
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
50 50
         $title = str_replace(' ', '_', $page->getTitle());
Please login to merge, or discard this patch.
src/Xtools/ArticleInfo.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public function getMaxRevisions()
161 161
     {
162 162
         if (!isset($this->maxRevisions)) {
163
-            $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions');
163
+            $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions');
164 164
         }
165 165
         return $this->maxRevisions;
166 166
     }
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
             if ($revCount === 0) {
635 635
                 $this->firstEdit = $edit;
636
-                $firstEditMonth = mktime(0, 0, 0, (int) $this->firstEdit->getMonth(), 1, $this->firstEdit->getYear());
636
+                $firstEditMonth = mktime(0, 0, 0, (int)$this->firstEdit->getMonth(), 1, $this->firstEdit->getYear());
637 637
             }
638 638
 
639 639
             $username = $edit->getUser()->getUsername();
@@ -827,14 +827,14 @@  discard block
 block discarded – undo
827 827
         $botData = $this->getRepository()->getBotData($this->page);
828 828
         while ($bot = $botData->fetch()) {
829 829
             $bots[$bot['username']] = [
830
-                'count' => (int) $bot['count'],
830
+                'count' => (int)$bot['count'],
831 831
                 'current' => $bot['current'] === 'bot'
832 832
             ];
833 833
             $sum += $bot['count'];
834 834
         }
835 835
 
836
-        uasort($bots, function ($a, $b) {
837
-            return $b['count'] - $a['count'];
836
+        uasort($bots, function($a, $b) {
837
+            return $b['count']-$a['count'];
838 838
         });
839 839
 
840 840
         $this->botRevisionCount = $sum;
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 
927 927
             if ($info['all'] > 1) {
928 928
                 // Number of seconds/days between first and last edit
929
-                $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp();
929
+                $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp();
930 930
                 $days = $secs / (60 * 60 * 24);
931 931
 
932 932
                 // Average time between edits (in days)
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 
946 946
         // First sort editors array by the amount of text they added
947 947
         $topTenEditorsByAdded = $this->editors;
948
-        uasort($topTenEditorsByAdded, function ($a, $b) {
948
+        uasort($topTenEditorsByAdded, function($a, $b) {
949 949
             if ($a['added'] === $b['added']) {
950 950
                 return 0;
951 951
             }
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 
955 955
         // Then build a new array of top 10 editors by added text,
956 956
         //   in the data structure needed for the chart
957
-        $this->topTenEditorsByAdded = array_map(function ($editor) {
957
+        $this->topTenEditorsByAdded = array_map(function($editor) {
958 958
             $added = $this->editors[$editor]['added'];
959 959
             return [
960 960
                 'label' => $editor,
Please login to merge, or discard this patch.