Passed
Pull Request — master (#222)
by MusikAnimal
06:35
created
src/Xtools/Project.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function getUrl($withTrailingSlash = true)
138 138
     {
139
-        return rtrim($this->getBasicInfo()['url'], '/') . ($withTrailingSlash ? '/' : '');
139
+        return rtrim($this->getBasicInfo()['url'], '/').($withTrailingSlash ? '/' : '');
140 140
     }
141 141
 
142 142
     /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $metadata = $this->getMetadata();
194 194
         return isset($metadata['general']['script'])
195 195
             ? $metadata['general']['script']
196
-            : $this->getScriptPath() . '/index.php';
196
+            : $this->getScriptPath().'/index.php';
197 197
     }
198 198
 
199 199
     /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function getApiUrl()
205 205
     {
206
-        return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath();
206
+        return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath();
207 207
     }
208 208
 
209 209
     /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      */
268 268
     public function userOptInPage(User $user)
269 269
     {
270
-        $localPageName = 'User:' . $user->getUsername() . '/EditCounterOptIn.js';
270
+        $localPageName = 'User:'.$user->getUsername().'/EditCounterOptIn.js';
271 271
         return $localPageName;
272 272
     }
273 273
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         }
303 303
 
304 304
         // 4. Lastly, see if they've opted in globally on the default project or Meta.
305
-        $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js';
305
+        $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js';
306 306
         $globalProject = $this->getRepository()->getGlobalProject();
307 307
         if ($globalProject instanceof Project) {
308 308
             $globalExists = $globalProject->getRepository()
Please login to merge, or discard this patch.
src/Xtools/EditCounterRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
         ])->fetchAll();
133 133
 
134 134
         $logCounts = array_combine(
135
-            array_map(function ($e) {
135
+            array_map(function($e) {
136 136
                 return $e['source'];
137 137
             }, $results),
138
-            array_map(function ($e) {
138
+            array_map(function($e) {
139 139
                 return $e['value'];
140 140
             }, $results)
141 141
         );
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
         $params = $user->isAnon() ? ['username' => $user->getUsername()] : ['userId' => $user->getId($project)];
347 347
         $results = $this->executeProjectsQuery($sql, $params)->fetchAll();
348 348
 
349
-        $namespaceTotals = array_combine(array_map(function ($e) {
349
+        $namespaceTotals = array_combine(array_map(function($e) {
350 350
             return $e['page_namespace'];
351
-        }, $results), array_map(function ($e) {
351
+        }, $results), array_map(function($e) {
352 352
             return $e['total'];
353 353
         }, $results));
354 354
 
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
                 ORDER BY revs.rev_timestamp DESC";
401 401
             $queries[] = $sql;
402 402
         }
403
-        $sql = "SELECT * FROM ((\n" . join("\n) UNION (\n", $queries) . ")) a ORDER BY timestamp DESC LIMIT $limit";
403
+        $sql = "SELECT * FROM ((\n".join("\n) UNION (\n", $queries).")) a ORDER BY timestamp DESC LIMIT $limit";
404 404
 
405 405
         if (is_numeric($offset)) {
406 406
             $sql .= " OFFSET $offset";
Please login to merge, or discard this patch.
src/Xtools/EditCounter.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
         // Filter out unblocks unless requested.
133 133
         if ($blocksOnly) {
134
-            $blocks = array_filter($blocks, function ($block) {
134
+            $blocks = array_filter($blocks, function($block) {
135 135
                 return $block['log_action'] === 'block';
136 136
             });
137 137
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function countAllRevisions()
167 167
     {
168
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
168
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
169 169
     }
170 170
 
171 171
     /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function countRevisionsWithoutComments()
186 186
     {
187
-        return $this->countLiveRevisions() - $this->countRevisionsWithComments();
187
+        return $this->countLiveRevisions()-$this->countRevisionsWithComments();
188 188
     }
189 189
 
190 190
     /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function countAllPagesEdited()
225 225
     {
226
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
226
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
227 227
     }
228 228
 
229 229
     /**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public function countPagesCreated()
235 235
     {
236
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
236
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
237 237
     }
238 238
 
239 239
     /**
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             } elseif ($block['log_action'] === 'unblock') {
374 374
                 // The last block was lifted. So the duration will be the time from when the
375 375
                 // last block was set to the time of the unblock.
376
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
376
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
377 377
                 if ($timeSinceLastBlock > $this->longestBlockSeconds) {
378 378
                     $this->longestBlockSeconds = $timeSinceLastBlock;
379 379
 
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
                 // The last block was modified. So we will adjust $lastBlock to include
385 385
                 // the difference of the duration of the new reblock, and time since the last block.
386 386
                 // $lastBlock is left unchanged if its duration was indefinite.
387
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
388
-                $lastBlock[1] = $timeSinceLastBlock + $duration;
387
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
388
+                $lastBlock[1] = $timeSinceLastBlock+$duration;
389 389
             }
390 390
         }
391 391
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         }
396 396
 
397 397
         // Test if the last block is still active, and if so use the expiry as the duration.
398
-        $lastBlockExpiry = $lastBlock[0] + $lastBlock[1];
398
+        $lastBlockExpiry = $lastBlock[0]+$lastBlock[1];
399 399
         if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) {
400 400
             $this->longestBlockSeconds = $lastBlock[1];
401 401
         // Otherwise, test if the duration of the last block is now the longest overall.
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         // If invalid, $duration is left as null.
437 437
         if (strtotime($durationStr)) {
438 438
             $expiry = strtotime($durationStr, $timestamp);
439
-            $duration = $expiry - $timestamp;
439
+            $duration = $expiry-$timestamp;
440 440
         }
441 441
 
442 442
         return [$timestamp, $duration];
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
514 514
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
515 515
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
516
-        return $import + $interwiki + $upload;
516
+        return $import+$interwiki+$upload;
517 517
     }
518 518
 
519 519
     /**
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
     public function approvals()
641 641
     {
642 642
         $logCounts = $this->getLogCounts();
643
-        $total = $logCounts['review-approve'] +
644
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
645
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
643
+        $total = $logCounts['review-approve']+
644
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
645
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
646 646
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
647 647
         return $total;
648 648
     }
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
         $logCounts = $this->getLogCounts();
667 667
         $create2 = $logCounts['newusers-create2'] ?: 0;
668 668
         $byemail = $logCounts['newusers-byemail'] ?: 0;
669
-        return $create2 + $byemail;
669
+        return $create2+$byemail;
670 670
     }
671 671
 
672 672
     /**
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 
750 750
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
751 751
         $out = [
752
-            'yearLabels' => [],  // labels for years
752
+            'yearLabels' => [], // labels for years
753 753
             'monthLabels' => [], // labels for months
754 754
             'totals' => [], // actual totals, grouped by namespace, year and then month
755 755
         ];
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
                 $out['totals'][$ns][$total['year']] = [];
817 817
             }
818 818
 
819
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
819
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
820 820
         }
821 821
 
822 822
         return [$out, $firstEdit];
@@ -833,9 +833,9 @@  discard block
 block discarded – undo
833 833
     private function fillInMonthTotalsAndLabels($out, DatePeriod $dateRange)
834 834
     {
835 835
         foreach ($dateRange as $monthObj) {
836
-            $year = (int) $monthObj->format('Y');
836
+            $year = (int)$monthObj->format('Y');
837 837
             $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy');
838
-            $month = (int) $monthObj->format('n');
838
+            $month = (int)$monthObj->format('n');
839 839
             $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM');
840 840
 
841 841
             // Fill in labels
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
 
985 985
         if ($sorted) {
986 986
             // Sort.
987
-            uasort($this->globalEditCounts, function ($a, $b) {
988
-                return $b['total'] - $a['total'];
987
+            uasort($this->globalEditCounts, function($a, $b) {
988
+                return $b['total']-$a['total'];
989 989
             });
990 990
         }
991 991
 
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
     public function countSmallEdits()
1074 1074
     {
1075 1075
         $editSizeData = $this->getEditSizeData();
1076
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
1076
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
1077 1077
     }
1078 1078
 
1079 1079
     /**
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
     public function countLargeEdits()
1084 1084
     {
1085 1085
         $editSizeData = $this->getEditSizeData();
1086
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
1086
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
1087 1087
     }
1088 1088
 
1089 1089
     /**
Please login to merge, or discard this patch.
src/Xtools/UserRightsRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             return $this->cache->getItem($cacheKey)->get();
125 125
         }
126 126
 
127
-        $rightsPaths = array_map(function ($right) {
127
+        $rightsPaths = array_map(function($right) {
128 128
             return "Group-$right-member";
129 129
         }, $this->getRawRightsNames($project));
130 130
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 FROM $revisionTable
263 263
                 WHERE rev_user = :userId
264 264
                 AND rev_timestamp >= $offset
265
-                LIMIT 1 OFFSET ".($edits - 1);
265
+                LIMIT 1 OFFSET ".($edits-1);
266 266
 
267 267
         $ret = $this->executeProjectsQuery($sql, [
268 268
             'userId' => $user->getId($project),
Please login to merge, or discard this patch.
src/Xtools/Repository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
             return null;
97 97
         }
98 98
 
99
-        $requestTime = microtime(true) - $request->server->get('REQUEST_TIME_FLOAT');
99
+        $requestTime = microtime(true)-$request->server->get('REQUEST_TIME_FLOAT');
100 100
 
101 101
         return [
102 102
             'requestTime' => round($requestTime, 2),
Please login to merge, or discard this patch.
src/Xtools/CategoryEdits.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     ) {
60 60
         $this->project = $project;
61 61
         $this->user = $user;
62
-        $this->categories = array_map(function ($category) {
62
+        $this->categories = array_map(function($category) {
63 63
             return str_replace(' ', '_', $category);
64 64
         }, $categories);
65 65
         $this->start = false === $start ? '' : date('Y-m-d', $start);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function getCategoriesNormalized()
93 93
     {
94
-        return array_map(function ($category) {
94
+        return array_map(function($category) {
95 95
             return str_replace('_', ' ', $category);
96 96
         }, $this->categories);
97 97
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     private function getEditsFromRevs(array $revs)
211 211
     {
212
-        return array_map(function ($rev) {
212
+        return array_map(function($rev) {
213 213
             /* @var Page Page object to be passed to the Edit contructor. */
214 214
             $page = $this->getPageFromRev($rev);
215 215
             $rev['user'] = $this->user;
Please login to merge, or discard this patch.
src/AppBundle/Controller/RfXVoteCalculatorController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,8 +136,8 @@
 block discarded – undo
136 136
             $titles = [];
137 137
 
138 138
             while ($row = $sth->fetch()) {
139
-                $titles[] = $namespaces[$row['page_namespace']] .
140
-                    ':' .$row['page_title'];
139
+                $titles[] = $namespaces[$row['page_namespace']].
140
+                    ':'.$row['page_title'];
141 141
             }
142 142
 
143 143
             // Chunking... it's possible to make a URI too long
Please login to merge, or discard this patch.
src/AppBundle/Controller/PagesController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -347,7 +347,7 @@
 block discarded – undo
347 347
         ];
348 348
 
349 349
         if ($pages->getNumResults() === $pages->resultsPerPage()) {
350
-            $ret['continue'] = $this->offset + 1;
350
+            $ret['continue'] = $this->offset+1;
351 351
         }
352 352
 
353 353
         return $this->getFormattedApiResponse($ret);
Please login to merge, or discard this patch.
src/AppBundle/Controller/AutomatedEditsController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             'total_editcount' => $this->autoEdits->getEditCount(),
239 239
             'automated_editcount' => $this->autoEdits->getAutomatedCount(),
240 240
         ];
241
-        $ret['nonautomated_editcount'] = $ret['total_editcount'] - $ret['automated_editcount'];
241
+        $ret['nonautomated_editcount'] = $ret['total_editcount']-$ret['automated_editcount'];
242 242
 
243 243
         if ($tools != '') {
244 244
             $tools = $this->autoEdits->getToolCounts();
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
         $this->setupAutoEdits();
272 272
 
273
-        $ret = array_map(function ($rev) {
273
+        $ret = array_map(function($rev) {
274 274
             return array_merge([
275 275
                 'full_page_title' => $this->getPageFromNsAndTitle($rev['page_namespace'], $rev['page_title'], true),
276 276
             ], $rev);
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             $ret['tool'] = $this->autoEdits->getTool();
308 308
         }
309 309
 
310
-        $ret['automated_edits'] = array_map(function ($rev) {
310
+        $ret['automated_edits'] = array_map(function($rev) {
311 311
             return array_merge([
312 312
                 'full_page_title' => $this->getPageFromNsAndTitle($rev['page_namespace'], $rev['page_title'], true),
313 313
             ], $rev);
Please login to merge, or discard this patch.