Test Failed
Pull Request — master (#203)
by Matthew
04:22
created
src/Xtools/AdminStats.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function numDays()
127 127
     {
128
-        return ($this->end - $this->start) / 60 / 60 / 24;
128
+        return ($this->end-$this->start) / 60 / 60 / 24;
129 129
     }
130 130
 
131 131
     /**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $stats = $this->groupAdminStatsByUsername($stats, $abbreviateGroups);
155 155
 
156 156
         // Resort, as for some reason the SQL isn't doing this properly.
157
-        uasort($stats, function ($a, $b) {
157
+        uasort($stats, function($a, $b) {
158 158
             if ($a['total'] === $b['total']) {
159 159
                 return 0;
160 160
             }
@@ -265,6 +265,6 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function getNumNonAdminsWithActions()
267 267
     {
268
-        return count($this->adminStats) - $this->numAdminsWithActions;
268
+        return count($this->adminStats)-$this->numAdminsWithActions;
269 269
     }
270 270
 }
Please login to merge, or discard this patch.
src/Xtools/AutoEditsRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             $tagJoin = $tags != '' ? "LEFT OUTER JOIN $tagTable ON ct_rev_id = rev_id" : '';
85 85
             $condTools[] = "ct_tag IN ($tags)";
86 86
         }
87
-        $condTool = 'AND (' . implode(' OR ', $condTools) . ')';
87
+        $condTool = 'AND ('.implode(' OR ', $condTools).')';
88 88
 
89 89
         $sql = "SELECT COUNT(DISTINCT(rev_id))
90 90
                 FROM $revisionTable
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 $condEnd";
98 98
 
99 99
         $resultQuery = $this->executeQuery($sql, $user, $namespace, $start, $end);
100
-        $result = (int) $resultQuery->fetchColumn();
100
+        $result = (int)$resultQuery->fetchColumn();
101 101
 
102 102
         // Cache and return.
103 103
         $this->stopwatch->stop($cacheKey);
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
         }
318 318
 
319 319
         // Sort the array by count
320
-        uasort($results, function ($a, $b) {
321
-            return $b['count'] - $a['count'];
320
+        uasort($results, function($a, $b) {
321
+            return $b['count']-$a['count'];
322 322
         });
323 323
 
324 324
         // Cache and return.
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
             // Developer error, no regex or tag provided for this tool.
361 361
             if ($condTool === '') {
362
-                throw new Exception("No regex or tag found for the tool $toolname. " .
362
+                throw new Exception("No regex or tag found for the tool $toolname. ".
363 363
                     "Please verify this entry in semi_automated.yml");
364 364
             }
365 365
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
             if ($condTool === '') {
417 417
                 $condTool = $tagClause;
418 418
             } else {
419
-                $condTool = '(' . $condTool . " OR $tagClause)";
419
+                $condTool = '('.$condTool." OR $tagClause)";
420 420
             }
421 421
         }
422 422
 
Please login to merge, or discard this patch.
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/AppBundle/Controller/QuoteController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             'quote/all.html.twig',
117 117
             [
118 118
                 'base_dir' => realpath(
119
-                    $this->getParameter('kernel.root_dir') . '/..'
119
+                    $this->getParameter('kernel.root_dir').'/..'
120 120
                 ),
121 121
                 'xtPage' => 'bash',
122 122
                 'quotes' => $quotes,
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             'quote/view.html.twig',
163 163
             [
164 164
                 'base_dir' => realpath(
165
-                    $this->getParameter('kernel.root_dir') . '/..'
165
+                    $this->getParameter('kernel.root_dir').'/..'
166 166
                 ),
167 167
                 "xtPage" => "bash",
168 168
                 "text" => $text,
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
         // Number the quotes, since they somehow have significance.
221 221
         foreach ($quotes as $index => $quote) {
222
-            $numberedQuotes[(string)$index + 1] = $quote;
222
+            $numberedQuotes[(string)$index+1] = $quote;
223 223
         }
224 224
 
225 225
         return new JsonResponse($numberedQuotes, Response::HTTP_OK);
Please login to merge, or discard this patch.
src/AppBundle/Controller/EditCounterController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
         }
134 134
 
135 135
         $ret = [
136
-            'xtTitle' => $this->user->getUsername() . ' - ' . $this->project->getTitle(),
136
+            'xtTitle' => $this->user->getUsername().' - '.$this->project->getTitle(),
137 137
             'xtPage' => 'editcounter',
138 138
             'user' => $this->user,
139 139
             'project' => $this->project,
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 >= $acDate
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/AppBundle/Controller/ArticleInfoController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
             $rendered = str_replace('"', '\"', trim($rendered));
89 89
 
90 90
             // Uglify temporary file.
91
-            $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js';
91
+            $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js';
92 92
             $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && ";
93
-            $script .= $this->get('kernel')->getRootDir() .
94
-                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " .
93
+            $script .= $this->get('kernel')->getRootDir().
94
+                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ".
95 95
                 "&& rm $tmpFile >/dev/null";
96 96
             $process = new Process($script);
97 97
             $process->run();
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
             $rendered = str_replace('\"', '"', trim($rendered));
111 111
 
112 112
             // Add comment after uglifying since it removes comments.
113
-            $rendered = "/**\n * This code was automatically generated and should not " .
114
-                "be manually edited.\n * For updates, please copy and paste from " .
115
-                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) .
116
-                "\n * Released under GPL v3 license.\n */\n" . $rendered;
113
+            $rendered = "/**\n * This code was automatically generated and should not ".
114
+                "be manually edited.\n * For updates, please copy and paste from ".
115
+                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL).
116
+                "\n * Released under GPL v3 license.\n */\n".$rendered;
117 117
         }
118 118
 
119 119
         $response = new \Symfony\Component\HttpFoundation\Response($rendered);
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $data = [
349 349
             'project' => $project->getDomain(),
350 350
             'page' => $page->getTitle(),
351
-            'watchers' => (int) $page->getWatchers(),
351
+            'watchers' => (int)$page->getWatchers(),
352 352
             'pageviews' => $page->getLastPageviews($pageviewsOffset),
353 353
             'pageviews_offset' => $pageviewsOffset,
354 354
         ];
@@ -371,22 +371,22 @@  discard block
 block discarded – undo
371 371
         if ($info != false) {
372 372
             $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
373 373
             $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
374
-            $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
374
+            $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
375 375
 
376 376
             $assessment = $page->getProject()
377 377
                 ->getPageAssessments()
378 378
                 ->getAssessment($page);
379 379
 
380 380
             $data = array_merge($data, [
381
-                'revisions' => (int) $info['num_edits'],
382
-                'editors' => (int) $info['num_editors'],
381
+                'revisions' => (int)$info['num_edits'],
382
+                'editors' => (int)$info['num_editors'],
383 383
                 'author' => $info['author'],
384
-                'author_editcount' => (int) $info['author_editcount'],
384
+                'author_editcount' => (int)$info['author_editcount'],
385 385
                 'created_at' => $creationDateTime->format('Y-m-d'),
386 386
                 'created_rev_id' => $info['created_rev_id'],
387 387
                 'modified_at' => $modifiedDateTime->format('Y-m-d H:i'),
388 388
                 'secs_since_last_edit' => $secsSinceLastEdit,
389
-                'last_edit_id' => (int) $info['modified_rev_id'],
389
+                'last_edit_id' => (int)$info['modified_rev_id'],
390 390
                 'assessment' => $assessment,
391 391
             ]);
392 392
         }
Please login to merge, or discard this patch.