Completed
Push — master ( 399d17...d05dd8 )
by MusikAnimal
17:54
created
src/Xtools/UserRepository.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * Get the user's (system) edit count.
97 97
      * @param string $databaseName The database to query.
98 98
      * @param string $username The username to find.
99
-     * @return int|null As returned by the database.
99
+     * @return string|boolean As returned by the database.
100 100
      */
101 101
     public function getEditCount($databaseName, $username)
102 102
     {
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
      * Get the combined regex and tags for all semi-automated tools,
742 742
      *   ready to be used in a query.
743 743
      * @param string $projectDomain Such as en.wikipedia.org
744
-     * @param $conn Doctrine\DBAL\Connection Used for proper escaping
744
+     * @param \Doctrine\DBAL\Connection $conn Doctrine\DBAL\Connection Used for proper escaping
745 745
      * @return string[] In the format:
746 746
      *    ['combined|regex', 'combined,tags']
747 747
      */
Please login to merge, or discard this patch.
src/Xtools/EditCounter.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function getLogCounts()
100 100
     {
101
-        if (! is_array($this->logCounts)) {
101
+        if (!is_array($this->logCounts)) {
102 102
             $this->logCounts = $this->getRepository()
103 103
                 ->getLogCounts($this->project, $this->user);
104 104
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function countAllRevisions()
149 149
     {
150
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
150
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
151 151
     }
152 152
 
153 153
     /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function countRevisionsWithoutComments()
168 168
     {
169
-        return $this->countLiveRevisions() - $this->countRevisionsWithComments();
169
+        return $this->countLiveRevisions()-$this->countRevisionsWithComments();
170 170
     }
171 171
 
172 172
     /**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function countAllPagesEdited()
207 207
     {
208
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
208
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
209 209
     }
210 210
 
211 211
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function countPagesCreated()
217 217
     {
218
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
218
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
219 219
     }
220 220
 
221 221
     /**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             // Try block just in case there are older, unpredictable formats
344 344
             try {
345 345
                 $expiry = strtotime($durationStr, $timestamp);
346
-                $duration = ($expiry - $timestamp) / (60 * 60 * 24);
346
+                $duration = ($expiry-$timestamp) / (60 * 60 * 24);
347 347
 
348 348
                 if (!$duration || $duration > $this->longestBlockDays) {
349 349
                     $this->longestBlockDays = $duration;
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
428 428
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
429 429
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
430
-        return $import + $interwiki + $upload;
430
+        return $import+$interwiki+$upload;
431 431
     }
432 432
 
433 433
     /**
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
     public function approvals()
552 552
     {
553 553
         $logCounts = $this->getLogCounts();
554
-        $total = $logCounts['review-approve'] +
555
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
556
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
554
+        $total = $logCounts['review-approve']+
555
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
556
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
557 557
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
558 558
         return $total;
559 559
     }
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         $logCounts = $this->getLogCounts();
578 578
         $create2 = $logCounts['newusers-create2'] ?: 0;
579 579
         $byemail = $logCounts['newusers-byemail'] ?: 0;
580
-        return $create2 + $byemail;
580
+        return $create2+$byemail;
581 581
     }
582 582
 
583 583
     /**
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 
630 630
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
631 631
         $out = [
632
-            'yearLabels' => [],  // labels for years
632
+            'yearLabels' => [], // labels for years
633 633
             'monthLabels' => [], // labels for months
634 634
             'totals' => [], // actual totals, grouped by namespace, year and then month
635 635
         ];
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                 $out['totals'][$ns][$total['year']] = [];
658 658
             }
659 659
 
660
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
660
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
661 661
         }
662 662
 
663 663
         $dateRange = new DatePeriod(
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
         );
668 668
 
669 669
         foreach ($dateRange as $monthObj) {
670
-            $year = (int) $monthObj->format('Y');
671
-            $month = (int) $monthObj->format('n');
670
+            $year = (int)$monthObj->format('Y');
671
+            $month = (int)$monthObj->format('n');
672 672
 
673 673
             // Fill in labels
674 674
             $out['monthLabels'][] = $monthObj->format('Y-m');
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
                 ->globalEditCounts($this->user, $this->project);
783 783
             if ($sorted) {
784 784
                 // Sort.
785
-                uasort($this->globalEditCounts, function ($a, $b) {
786
-                    return $b['total'] - $a['total'];
785
+                uasort($this->globalEditCounts, function($a, $b) {
786
+                    return $b['total']-$a['total'];
787 787
                 });
788 788
             }
789 789
         }
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
820 820
             }
821 821
             $page = $project->getRepository()
822
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
822
+                ->getPage($project, $nsName.':'.$revision['page_title']);
823 823
             $edit = new Edit($page, $revision);
824 824
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
825 825
         }
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
      */
837 837
     protected function getEditSizeData()
838 838
     {
839
-        if (! is_array($this->editSizeData)) {
839
+        if (!is_array($this->editSizeData)) {
840 840
             $this->editSizeData = $this->getRepository()
841 841
                 ->getEditSizeData($this->project, $this->user);
842 842
         }
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
     public function countSmallEdits()
861 861
     {
862 862
         $editSizeData = $this->getEditSizeData();
863
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
863
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
864 864
     }
865 865
 
866 866
     /**
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
     public function countLargeEdits()
871 871
     {
872 872
         $editSizeData = $this->getEditSizeData();
873
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
873
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
874 874
     }
875 875
 
876 876
     /**
Please login to merge, or discard this patch.
src/Xtools/User.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $this->getUsername()
90 90
         );
91 91
 
92
-        return (int) $editCount;
92
+        return (int)$editCount;
93 93
     }
94 94
 
95 95
     /**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function countAutomatedEdits(Project $project, $namespace = 'all', $start = '', $end = '')
206 206
     {
207
-        return (int) $this->getRepository()->countAutomatedEdits($project, $this, $namespace, $start, $end);
207
+        return (int)$this->getRepository()->countAutomatedEdits($project, $this, $namespace, $start, $end);
208 208
     }
209 209
 
210 210
     /**
@@ -236,21 +236,21 @@  discard block
 block discarded – undo
236 236
 
237 237
         $namespaces = $project->getNamespaces();
238 238
 
239
-        return array_map(function ($rev) use ($namespaces) {
239
+        return array_map(function($rev) use ($namespaces) {
240 240
             $pageTitle = $rev['page_title'];
241 241
 
242 242
             if ($rev['page_namespace'] !== '0') {
243
-                $pageTitle = $namespaces[$rev['page_namespace']] . ":$pageTitle";
243
+                $pageTitle = $namespaces[$rev['page_namespace']].":$pageTitle";
244 244
             }
245 245
 
246 246
             return [
247 247
                 'page_title' => $pageTitle,
248
-                'page_namespace' => (int) $rev['page_namespace'],
249
-                'rev_id' => (int) $rev['rev_id'],
248
+                'page_namespace' => (int)$rev['page_namespace'],
249
+                'rev_id' => (int)$rev['rev_id'],
250 250
                 'timestamp' => DateTime::createFromFormat('YmdHis', $rev['timestamp']),
251
-                'minor' => (bool) $rev['minor'],
252
-                'length' => (int) $rev['length'],
253
-                'length_change' => (int) $rev['length_change'],
251
+                'minor' => (bool)$rev['minor'],
252
+                'length' => (int)$rev['length'],
253
+                'length_change' => (int)$rev['length_change'],
254 254
                 'comment' => $rev['comment'],
255 255
             ];
256 256
         }, $revs);
Please login to merge, or discard this patch.
src/AppBundle/Controller/EditCounterController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
         $username = $request->query->get('username', $request->query->get('user'));
88 88
 
89 89
         if (($project || $queryProject) && $username) {
90
-            $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ];
90
+            $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username];
91 91
             return $this->redirectToRoute("EditCounterResult", $routeParams);
92 92
         } elseif (!$project && $queryProject) {
93
-            return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]);
93
+            return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]);
94 94
         }
95 95
 
96 96
         $project = ProjectRepository::getProject($queryProject, $this->container);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $this->setUpEditCounter($project, $username);
121 121
         $isSubRequest = $this->container->get('request_stack')->getParentRequest() !== null;
122 122
         return $this->render('editCounter/result.html.twig', [
123
-            'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(),
123
+            'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(),
124 124
             'xtPage' => 'ec',
125 125
             'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
126 126
             'is_sub_request' => $isSubRequest,
Please login to merge, or discard this patch.