Completed
Push — master ( 8fd593...b87b1f )
by Sam
02:50
created
src/AppBundle/Controller/SimpleEditCounterController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         // If we've got a project and user, redirect to results.
43 43
         if ($projectName != '' && $username != '') {
44
-            $routeParams = [ 'project' => $projectName, 'username' => $username ];
44
+            $routeParams = ['project' => $projectName, 'username' => $username];
45 45
             return $this->redirectToRoute('SimpleEditCounterResult', $routeParams);
46 46
         }
47 47
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
         $resultQuery->execute();
109 109
 
110 110
         if ($resultQuery->errorCode() > 0) {
111
-            $this->addFlash('notice', [ 'no-result', $username ]);
112
-            return $this->redirectToRoute('SimpleEditCounterProject', [ 'project' => $project->getDomain() ]);
111
+            $this->addFlash('notice', ['no-result', $username]);
112
+            return $this->redirectToRoute('SimpleEditCounterProject', ['project' => $project->getDomain()]);
113 113
         }
114 114
 
115 115
         // Fetch the result data
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
                 $rev = $row['value'];
134 134
             }
135 135
             if ($row['source'] == 'groups') {
136
-                $groups .= $row['value']. ', ';
136
+                $groups .= $row['value'].', ';
137 137
             }
138 138
         }
139 139
 
140 140
         // Unknown user - If the user is created the $results variable will have 3 entries.
141 141
         // This is a workaround to detect non-existent IPs.
142 142
         if (count($results) < 3 && $arch == 0 && $rev == 0) {
143
-            $this->addFlash('notice', [ 'no-result', $username ]);
143
+            $this->addFlash('notice', ['no-result', $username]);
144 144
 
145
-            return $this->redirectToRoute('SimpleEditCounterProject', [ 'project' => $project->getDomain() ]);
145
+            return $this->redirectToRoute('SimpleEditCounterProject', ['project' => $project->getDomain()]);
146 146
         }
147 147
 
148 148
         // Remove the last comma and space
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             'project_url' => $url,
173 173
             'id' => $id,
174 174
             'arch' => $arch,
175
-            'rev' => $rev + $arch,
175
+            'rev' => $rev+$arch,
176 176
             'live' => $rev,
177 177
             'groups' => $groups,
178 178
             'globalGroups' => $globalGroups,
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
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
         $username = $request->query->get('username', $request->query->get('user'));
77 77
 
78 78
         if (($project || $queryProject) && $username) {
79
-            $routeParams = [ 'project'=>($project ?: $queryProject), 'username' => $username ];
79
+            $routeParams = ['project'=>($project ?: $queryProject), 'username' => $username];
80 80
             return $this->redirectToRoute("EditCounterResult", $routeParams);
81 81
         } elseif (!$project && $queryProject) {
82
-            return $this->redirectToRoute("EditCounterProject", [ 'project'=>$queryProject ]);
82
+            return $this->redirectToRoute("EditCounterProject", ['project'=>$queryProject]);
83 83
         }
84 84
 
85 85
         $project = ProjectRepository::getProject($queryProject, $this->container);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $this->setUpEditCounter($project, $username);
110 110
         $isSubRequest = $this->container->get('request_stack')->getParentRequest() !== null;
111 111
         return $this->render('editCounter/result.html.twig', [
112
-            'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(),
112
+            'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(),
113 113
             'xtPage' => 'ec',
114 114
             'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
115 115
             'is_labs' => $this->project->getRepository()->isLabs(),
Please login to merge, or discard this patch.
src/Xtools/ProjectRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 if ($projMetadata['dbname'] == "$project"
140 140
                     || $projMetadata['url'] == "$project"
141 141
                     || $projMetadata['url'] == "https://$project") {
142
-                    $this->log->debug(__METHOD__ . " Using cached data for $project");
142
+                    $this->log->debug(__METHOD__." Using cached data for $project");
143 143
                     return $projMetadata;
144 144
                 }
145 145
             }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         $optedIn = $this->container->getParameter('opted_in');
260 260
         // In case there's just one given.
261 261
         if (!is_array($optedIn)) {
262
-            $optedIn = [ $optedIn ];
262
+            $optedIn = [$optedIn];
263 263
         }
264 264
         return $optedIn;
265 265
     }
Please login to merge, or discard this patch.
src/AppBundle/Helper/LabsHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
         // as required by Labs.  We combine $table with
75 75
         // $table_extension in order to generate the new table name
76 76
         if ($this->isLabs() && $table_extension !== null) {
77
-            $table = $table . "_" . $table_extension;
77
+            $table = $table."_".$table_extension;
78 78
         }
79 79
 
80 80
         // Use the table specified in the table mapping configuration, if present.
Please login to merge, or discard this patch.
src/AppBundle/Controller/ApiController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
         }
140 140
 
141 141
         $conn = $this->getDoctrine()->getManager('default')->getConnection();
142
-        $date =  date('Y-m-d');
142
+        $date = date('Y-m-d');
143 143
 
144 144
         // Increment count in timeline
145 145
         $existsSql = "SELECT 1 FROM usage_timeline
Please login to merge, or discard this patch.
src/AppBundle/Controller/MetaController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $end = $request->query->get('end');
32 32
 
33 33
         if ($start != '' && $end != '') {
34
-            return $this->redirectToRoute('MetaResult', [ 'start' => $start, 'end' => $end ]);
34
+            return $this->redirectToRoute('MetaResult', ['start' => $start, 'end' => $end]);
35 35
         }
36 36
 
37 37
         return $this->render('meta/index.html.twig', [
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $timeline = [];
74 74
         $startObj = new DateTime($start);
75 75
         $endObj = new DateTime($end);
76
-        $numDays = (int) $endObj->diff($startObj)->format("%a");
76
+        $numDays = (int)$endObj->diff($startObj)->format("%a");
77 77
         $grandSum = 0;
78 78
 
79 79
         // Generate array of date labels
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 
86 86
         foreach ($data as $entry) {
87 87
             if (!isset($totals[$entry['tool']])) {
88
-                $totals[$entry['tool']] = (int) $entry['count'];
88
+                $totals[$entry['tool']] = (int)$entry['count'];
89 89
 
90 90
                 // Create arrays for each tool, filled with zeros for each date in the timeline
91 91
                 $timeline[$entry['tool']] = array_fill(0, $numDays, 0);
92 92
             } else {
93
-                $totals[$entry['tool']] += (int) $entry['count'];
93
+                $totals[$entry['tool']] += (int)$entry['count'];
94 94
             }
95 95
 
96 96
             $date = new DateTime($entry['date']);
97
-            $dateIndex = (int) $date->diff($startObj)->format("%a");
98
-            $timeline[$entry['tool']][$dateIndex] = (int) $entry['count'];
97
+            $dateIndex = (int)$date->diff($startObj)->format("%a");
98
+            $timeline[$entry['tool']][$dateIndex] = (int)$entry['count'];
99 99
 
100 100
             $grandSum += $entry['count'];
101 101
         }
Please login to merge, or discard this patch.
src/AppBundle/Controller/PagesController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 'username' => $username,
79 79
             ]);
80 80
         } elseif ($projectQuery != "") {
81
-            return $this->redirectToRoute("PagesProject", [ 'project'=>$projectQuery ]);
81
+            return $this->redirectToRoute("PagesProject", ['project'=>$projectQuery]);
82 82
         }
83 83
 
84 84
         // set default wiki so we can populate the namespace selector
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             JOIN $revisionTable ON page_id = rev_page
197 197
             $paJoin
198 198
             WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition
199
-            " . ($hasPageAssessments ? 'GROUP BY rev_page' : '') . "
199
+            ".($hasPageAssessments ? 'GROUP BY rev_page' : '')."
200 200
             )
201 201
 
202 202
             UNION
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
         }
281 281
 
282 282
         if ($total < 1) {
283
-            $this->addFlash('notice', [ 'no-result', $username ]);
284
-            return $this->redirectToRoute('PagesProject', [ 'project' => $project ]);
283
+            $this->addFlash('notice', ['no-result', $username]);
284
+            return $this->redirectToRoute('PagesProject', ['project' => $project]);
285 285
         }
286 286
 
287 287
         ksort($pagesByNamespaceByDate);
Please login to merge, or discard this patch.
src/AppBundle/Controller/TopEditsController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 'username' => $username,
76 76
             ]);
77 77
         } elseif ($projectName != "") {
78
-            return $this->redirectToRoute("TopEditsResults", [ 'project'=>$projectName ]);
78
+            return $this->redirectToRoute("TopEditsResults", ['project'=>$projectName]);
79 79
         }
80 80
 
81 81
         // Set default project so we can populate the namespace selector.
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
         }
180 180
 
181 181
         // Get page info about these 100 pages, so we can use their display title.
182
-        $titles = array_map(function ($e) use ($namespaces) {
182
+        $titles = array_map(function($e) use ($namespaces) {
183 183
             // If non-mainspace, prepend namespace to the titles.
184 184
             $ns = $e['page_namespace'];
185
-            $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']] . ':' : '';
186
-            return $nsTitle . $e['page_title'];
185
+            $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']].':' : '';
186
+            return $nsTitle.$e['page_title'];
187 187
         }, $editData);
188 188
         /** @var ApiHelper $apiHelper */
189 189
         $apiHelper = $this->get('app.api_helper');
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
         foreach ($editData as $editDatum) {
199 199
             // If non-mainspace, prepend namespace to the titles.
200 200
             $ns = $editDatum['page_namespace'];
201
-            $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']] . ':' : '';
202
-            $pageTitle = $nsTitle . $editDatum['page_title'];
201
+            $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']].':' : '';
202
+            $pageTitle = $nsTitle.$editDatum['page_title'];
203 203
             $editDatum['displaytitle'] = $displayTitles[$pageTitle];
204 204
             // $editDatum['page_title'] is retained without the namespace
205 205
             //  so we can link to TopEdits for that page
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         // Send all to the template.
261 261
         return $this->render('topedits/result_article.html.twig', [
262 262
             'xtPage' => 'topedits',
263
-            'xtTitle' => $user->getUsername() . ' - ' . $page->getTitle(),
263
+            'xtTitle' => $user->getUsername().' - '.$page->getTitle(),
264 264
             'project' => $project,
265 265
             'user' => $user,
266 266
             'page' => $page,
Please login to merge, or discard this patch.
src/Xtools/EditCounter.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     protected function getRevisionCounts()
56 56
     {
57
-        if (! is_array($this->revisionCounts)) {
57
+        if (!is_array($this->revisionCounts)) {
58 58
             $this->revisionCounts = $this->getRepository()
59 59
                 ->getRevisionCounts($this->project, $this->user);
60 60
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function getRevisionDates()
69 69
     {
70
-        if (! is_array($this->revisionDates)) {
70
+        if (!is_array($this->revisionDates)) {
71 71
             $this->revisionDates = $this->getRepository()
72 72
                 ->getRevisionDates($this->project, $this->user);
73 73
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     protected function getPageCounts()
82 82
     {
83
-        if (! is_array($this->pageCounts)) {
83
+        if (!is_array($this->pageCounts)) {
84 84
             $this->pageCounts = $this->getRepository()
85 85
                 ->getPageCounts($this->project, $this->user);
86 86
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     protected function getLogCounts()
95 95
     {
96
-        if (! is_array($this->logCounts)) {
96
+        if (!is_array($this->logCounts)) {
97 97
             $this->logCounts = $this->getRepository()
98 98
                 ->getLogCounts($this->project, $this->user);
99 99
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function countAllRevisions()
144 144
     {
145
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
145
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
146 146
     }
147 147
 
148 148
     /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function countRevisionsWithoutComments()
163 163
     {
164
-        return $this->countAllRevisions() - $this->countRevisionsWithComments();
164
+        return $this->countAllRevisions()-$this->countRevisionsWithComments();
165 165
     }
166 166
 
167 167
     /**
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function countAllPagesEdited()
230 230
     {
231
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
231
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
232 232
     }
233 233
 
234 234
     /**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function countPagesCreated()
240 240
     {
241
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
241
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
242 242
     }
243 243
 
244 244
     /**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         $logCounts = $this->getLogCounts();
291 291
         $block = isset($logCounts['block-block']) ? (int)$logCounts['block-block'] : 0;
292 292
         $reBlock = isset($logCounts['block-reblock']) ? (int)$logCounts['block-reblock'] : 0;
293
-        return $block + $reBlock;
293
+        return $block+$reBlock;
294 294
     }
295 295
 
296 296
     /**
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
389 389
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
390 390
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
391
-        return $import + $interwiki + $upload;
391
+        return $import+$interwiki+$upload;
392 392
     }
393 393
 
394 394
     /**
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
     public function approvals()
522 522
     {
523 523
         $logCounts = $this->getLogCounts();
524
-        $total = $logCounts['review-approve'] +
525
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
526
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
524
+        $total = $logCounts['review-approve']+
525
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
526
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
527 527
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
528 528
         return $total;
529 529
     }
@@ -605,14 +605,14 @@  discard block
 block discarded – undo
605 605
             if (!isset($out['totals'][$ns])) {
606 606
                 $out['totals'][$ns] = [];
607 607
             }
608
-            $out['totals'][$ns][$total['year'] . $total['month']] = $total['count'];
608
+            $out['totals'][$ns][$total['year'].$total['month']] = $total['count'];
609 609
         }
610 610
         // Fill in the blanks (where no edits were made in a given month for a namespace).
611 611
         for ($y = $out['min_year']; $y <= $out['max_year']; $y++) {
612 612
             for ($m = 1; $m <= 12; $m++) {
613 613
                 foreach ($out['totals'] as $nsId => &$total) {
614
-                    if (!isset($total[$y . $m])) {
615
-                        $total[$y . $m] = 0;
614
+                    if (!isset($total[$y.$m])) {
615
+                        $total[$y.$m] = 0;
616 616
                     }
617 617
                 }
618 618
             }
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
         // Get counts.
631 631
         $editCounts = $this->globalEditCounts();
632 632
         // Sort.
633
-        uasort($editCounts, function ($a, $b) {
634
-            return $b['total'] - $a['total'];
633
+        uasort($editCounts, function($a, $b) {
634
+            return $b['total']-$a['total'];
635 635
         });
636 636
         // Truncate, and return.
637 637
         return array_slice($editCounts, 0, $numProjects);
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
             foreach ($revisions as &$revision) {
688 688
                 $nsName = $otherProject->getNamespaces()[$revision['page_namespace']];
689 689
                 $page = $otherProject->getRepository()
690
-                    ->getPage($otherProject, $nsName . ':' . $revision['page_title']);
690
+                    ->getPage($otherProject, $nsName.':'.$revision['page_title']);
691 691
                 $edit = new Edit($page, $revision);
692 692
 
693 693
                 // If we've already got enough, only check for those newer than the current oldest.
Please login to merge, or discard this patch.