Completed
Push — master ( 190d9b...e1c46c )
by MusikAnimal
13s
created
src/AppBundle/Controller/EditCounterController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
 use Symfony\Component\HttpFoundation\JsonResponse;
14 14
 use Xtools\EditCounter;
15 15
 use Xtools\EditCounterRepository;
16
-use Xtools\Page;
17 16
 use Xtools\Project;
18 17
 use Xtools\ProjectRepository;
19 18
 use Xtools\User;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
         $username = $request->query->get('username', $request->query->get('user'));
99 99
 
100 100
         if (($project || $queryProject) && $username) {
101
-            $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ];
101
+            $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username];
102 102
             return $this->redirectToRoute("EditCounterResult", $routeParams);
103 103
         } elseif (!$project && $queryProject) {
104
-            return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]);
104
+            return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]);
105 105
         }
106 106
 
107 107
         $project = ProjectRepository::getProject($queryProject, $this->container);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $isSubRequest = $this->container->get('request_stack')->getParentRequest() !== null;
142 142
 
143 143
         return $this->render('editCounter/result.html.twig', [
144
-            'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(),
144
+            'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(),
145 145
             'xtPage' => 'ec',
146 146
             'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
147 147
             'is_sub_request' => $isSubRequest,
Please login to merge, or discard this patch.
src/Xtools/Repository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         // Ensure there's a trailing slash.
153 153
         $apiRoot = trim($this->container->getParameter('app.multithread.api_url'), '/');
154
-        $endpoint = $apiRoot . '/api/' . $endpoint;
154
+        $endpoint = $apiRoot.'/api/'.$endpoint;
155 155
 
156 156
         if ($async) {
157 157
             return $this->apiConnection->getAsync($endpoint);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         // $tableExtension in order to generate the new table name
178 178
         if ($this->isLabs() && $tableExtension !== null) {
179 179
             $mapped = true;
180
-            $tableName = $tableName . '_' . $tableExtension;
180
+            $tableName = $tableName.'_'.$tableExtension;
181 181
         } elseif ($this->container->hasParameter("app.table.$tableName")) {
182 182
             // Use the table specified in the table mapping configuration, if present.
183 183
             $mapped = true;
Please login to merge, or discard this patch.
src/Xtools/EditCounter.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
             $promises[] = $promise;
118 118
 
119 119
             // Handle response of $promise asynchronously.
120
-            $promise->then(function ($response) use ($key, $endpoint) {
121
-                $result = (array) json_decode($response->getBody()->getContents());
120
+            $promise->then(function($response) use ($key, $endpoint) {
121
+                $result = (array)json_decode($response->getBody()->getContents());
122 122
 
123 123
                 if (isset($result)) {
124 124
                     // Copy result to the class class instance. From here any subsequent
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                     // We'll log this to see how often it happens.
132 132
                     $this->getRepository()
133 133
                         ->getLog()
134
-                        ->error("Failed to fetch data for $endpoint via async, " .
134
+                        ->error("Failed to fetch data for $endpoint via async, ".
135 135
                             "re-attempting synchoronously.");
136 136
                 }
137 137
             });
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function countAllRevisions()
214 214
     {
215
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
215
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
216 216
     }
217 217
 
218 218
     /**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      */
232 232
     public function countRevisionsWithoutComments()
233 233
     {
234
-        return $this->countLiveRevisions() - $this->countRevisionsWithComments();
234
+        return $this->countLiveRevisions()-$this->countRevisionsWithComments();
235 235
     }
236 236
 
237 237
     /**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function countAllPagesEdited()
272 272
     {
273
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
273
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
274 274
     }
275 275
 
276 276
     /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      */
281 281
     public function countPagesCreated()
282 282
     {
283
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
283
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
284 284
     }
285 285
 
286 286
     /**
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             // Try block just in case there are older, unpredictable formats
409 409
             try {
410 410
                 $expiry = strtotime($durationStr, $timestamp);
411
-                $duration = ($expiry - $timestamp) / (60 * 60 * 24);
411
+                $duration = ($expiry-$timestamp) / (60 * 60 * 24);
412 412
 
413 413
                 if (!$duration || $duration > $this->longestBlockDays) {
414 414
                     $this->longestBlockDays = $duration;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
493 493
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
494 494
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
495
-        return $import + $interwiki + $upload;
495
+        return $import+$interwiki+$upload;
496 496
     }
497 497
 
498 498
     /**
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
     public function approvals()
617 617
     {
618 618
         $logCounts = $this->getLogCounts();
619
-        $total = $logCounts['review-approve'] +
620
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
621
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
619
+        $total = $logCounts['review-approve']+
620
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
621
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
622 622
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
623 623
         return $total;
624 624
     }
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
         $logCounts = $this->getLogCounts();
643 643
         $create2 = $logCounts['newusers-create2'] ?: 0;
644 644
         $byemail = $logCounts['newusers-byemail'] ?: 0;
645
-        return $create2 + $byemail;
645
+        return $create2+$byemail;
646 646
     }
647 647
 
648 648
     /**
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 
695 695
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
696 696
         $out = [
697
-            'yearLabels' => [],  // labels for years
697
+            'yearLabels' => [], // labels for years
698 698
             'monthLabels' => [], // labels for months
699 699
             'totals' => [], // actual totals, grouped by namespace, year and then month
700 700
         ];
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
                 $out['totals'][$ns][$total['year']] = [];
723 723
             }
724 724
 
725
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
725
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
726 726
         }
727 727
 
728 728
         $dateRange = new DatePeriod(
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
         );
733 733
 
734 734
         foreach ($dateRange as $monthObj) {
735
-            $year = (int) $monthObj->format('Y');
736
-            $month = (int) $monthObj->format('n');
735
+            $year = (int)$monthObj->format('Y');
736
+            $month = (int)$monthObj->format('n');
737 737
 
738 738
             // Fill in labels
739 739
             $out['monthLabels'][] = $monthObj->format('Y-m');
@@ -849,8 +849,8 @@  discard block
 block discarded – undo
849 849
 
850 850
         if ($sorted) {
851 851
             // Sort.
852
-            uasort($this->globalEditCounts, function ($a, $b) {
853
-                return $b['total'] - $a['total'];
852
+            uasort($this->globalEditCounts, function($a, $b) {
853
+                return $b['total']-$a['total'];
854 854
             });
855 855
         }
856 856
 
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
                 $nsName = $project->getNamespaces()[$revision['page_namespace']];
887 887
             }
888 888
             $page = $project->getRepository()
889
-                ->getPage($project, $nsName . ':' . $revision['page_title']);
889
+                ->getPage($project, $nsName.':'.$revision['page_title']);
890 890
             $edit = new Edit($page, $revision);
891 891
             $globalEdits[$edit->getTimestamp()->getTimestamp().'-'.$edit->getId()] = $edit;
892 892
         }
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
     public function countSmallEdits()
928 928
     {
929 929
         $editSizeData = $this->getEditSizeData();
930
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
930
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
931 931
     }
932 932
 
933 933
     /**
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
     public function countLargeEdits()
938 938
     {
939 939
         $editSizeData = $this->getEditSizeData();
940
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
940
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
941 941
     }
942 942
 
943 943
     /**
Please login to merge, or discard this patch.