Passed
Push — temp-accounts ( 76d7c0...a2d054 )
by MusikAnimal
06:23 queued 02:59
created
src/Helper/I18nHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Helper;
6 6
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         }
55 55
 
56 56
         // Find the path, and complain if English doesn't exist.
57
-        $path = $this->projectDir . '/i18n';
57
+        $path = $this->projectDir.'/i18n';
58 58
         if (!file_exists("$path/en.json")) {
59 59
             throw new Exception("Language directory doesn't exist: $path");
60 60
         }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $messageFiles = glob($this->projectDir.'/i18n/*.json');
106 106
 
107 107
         $languages = array_values(array_unique(array_map(
108
-            function ($filename) {
108
+            function($filename) {
109 109
                 return basename($filename, '.json');
110 110
             },
111 111
             $messageFiles
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             $this->getIntuition()->getLangFallbacks($useLang)
150 150
         );
151 151
 
152
-        return array_filter($fallbacks, function ($lang) use ($i18nPath) {
152
+        return array_filter($fallbacks, function($lang) use ($i18nPath) {
153 153
             return is_file($i18nPath.$lang.'.json');
154 154
         });
155 155
     }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      */
288 288
     private function getLangForTranslatingNumerals(): string
289 289
     {
290
-        return 'ar' === $this->getIntuition()->getLang() ? 'en': $this->getIntuition()->getLang();
290
+        return 'ar' === $this->getIntuition()->getLang() ? 'en' : $this->getIntuition()->getLang();
291 291
     }
292 292
 
293 293
     /**
Please login to merge, or discard this patch.
src/Model/PageInfo.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1319,10 +1319,10 @@
 block discarded – undo
1319 1319
         // Slice to the top 10.
1320 1320
         $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true));
1321 1321
 
1322
-         // Get the sum of added text so that we can add in percentages.
1323
-         $topTenTotalAdded = array_sum(array_map(function ($editor) {
1324
-             return $this->editors[$editor]['added'];
1325
-         }, $topTenEditorsByAdded));
1322
+            // Get the sum of added text so that we can add in percentages.
1323
+            $topTenTotalAdded = array_sum(array_map(function ($editor) {
1324
+                return $this->editors[$editor]['added'];
1325
+            }, $topTenEditorsByAdded));
1326 1326
 
1327 1327
         // Then build a new array of top 10 editors by added text in the data structure needed for the chart.
1328 1328
         return array_map(function ($editor) use ($topTenTotalAdded) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Model;
6 6
 
@@ -958,16 +958,16 @@  discard block
 block discarded – undo
958 958
 
959 959
             if ($info['all'] > 1) {
960 960
                 // Number of seconds/days between first and last edit.
961
-                $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp();
961
+                $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp();
962 962
                 $days = $secs / (60 * 60 * 24);
963 963
 
964 964
                 // Average time between edits (in days).
965
-                $this->editors[$editor]['atbe'] = round($days / ($info['all'] - 1), 1);
965
+                $this->editors[$editor]['atbe'] = round($days / ($info['all']-1), 1);
966 966
             }
967 967
         }
968 968
 
969 969
         // Loop through again and add percentages.
970
-        $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) {
970
+        $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) {
971 971
             $editor['percentage'] = 100 * ($editor['value'] / $topTenCount);
972 972
             return $editor;
973 973
         }, $topTenEditorsByEdits);
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
     {
986 986
         // First sort editors array by the amount of text they added.
987 987
         $topTenEditorsByAdded = $this->editors;
988
-        uasort($topTenEditorsByAdded, function ($a, $b) {
988
+        uasort($topTenEditorsByAdded, function($a, $b) {
989 989
             if ($a['added'] === $b['added']) {
990 990
                 return 0;
991 991
             }
@@ -996,12 +996,12 @@  discard block
 block discarded – undo
996 996
         $topTenEditorsByAdded = array_keys(array_slice($topTenEditorsByAdded, 0, 10, true));
997 997
 
998 998
          // Get the sum of added text so that we can add in percentages.
999
-         $topTenTotalAdded = array_sum(array_map(function ($editor) {
999
+         $topTenTotalAdded = array_sum(array_map(function($editor) {
1000 1000
              return $this->editors[$editor]['added'];
1001 1001
          }, $topTenEditorsByAdded));
1002 1002
 
1003 1003
         // Then build a new array of top 10 editors by added text in the data structure needed for the chart.
1004
-        return array_map(function ($editor) use ($topTenTotalAdded) {
1004
+        return array_map(function($editor) use ($topTenTotalAdded) {
1005 1005
             $added = $this->editors[$editor]['added'];
1006 1006
             return [
1007 1007
                 'label' => $editor,
Please login to merge, or discard this patch.
src/Repository/PageInfoRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Repository;
6 6
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
         $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp'
175 175
                 FROM $loggingTable
176
-                WHERE log_namespace = '" . $page->getNamespace() . "'
176
+                WHERE log_namespace = '".$page->getNamespace()."'
177 177
                 AND log_title = :title AND log_timestamp > 1 $datesConditions
178 178
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
179 179
         $title = str_replace(' ', '_', $page->getTitle());
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         $time2 = time();
359 359
 
360 360
         // If it took over 5 seconds, cache the result for 20 minutes.
361
-        if ($time2 - $time1 > 5) {
361
+        if ($time2-$time1 > 5) {
362 362
             $this->setCache($cacheKey, $result, 'PT20M');
363 363
         }
364 364
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
         }
430 430
 
431 431
         // Sort the array by count
432
-        uasort($results, function ($a, $b) {
433
-            return $b['count'] - $a['count'];
432
+        uasort($results, function($a, $b) {
433
+            return $b['count']-$a['count'];
434 434
         });
435 435
 
436 436
         return $this->setCache($cacheKey, $results);
Please login to merge, or discard this patch.
src/Model/Pages.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Model;
6 6
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         }
135 135
 
136 136
         $numResults = count($this->getResults()[$this->getNamespace()]);
137
-        $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults - 1]['timestamp']);
137
+        $timestamp = new DateTime($this->getResults()[$this->getNamespace()][$numResults-1]['timestamp']);
138 138
         return $timestamp->format('Y-m-d\TH:i:s\Z');
139 139
     }
140 140
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
         $summaryColumns[] = 'average-page-size';
343 343
 
344 344
         // Re-sort based on $order
345
-        return array_values(array_filter($order, static function ($column) use ($summaryColumns) {
345
+        return array_values(array_filter($order, static function($column) use ($summaryColumns) {
346 346
             return in_array($column, $summaryColumns);
347 347
         }));
348 348
     }
Please login to merge, or discard this patch.
src/Model/Edit.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Model;
6 6
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         User $user,
113 113
         array $revs
114 114
     ): array {
115
-        return array_map(function ($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) {
115
+        return array_map(function($rev) use ($pageRepo, $editRepo, $userRepo, $project, $user) {
116 116
             /** Page object to be passed to the Edit constructor. */
117 117
             $page = Page::newFromRow($pageRepo, $project, $rev);
118 118
             $rev['user'] = $user;
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
             // Must have underscores for the link to properly go to the section.
359 359
             $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle));
360 360
 
361
-            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</a>" .
362
-                "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> ";
361
+            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</a>".
362
+                "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> ";
363 363
             $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary);
364 364
         }
365 365
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
      */
407 407
     public function getDiffUrl(): string
408 408
     {
409
-        return rtrim($this->getProject()->getUrlForPage('Special:Diff/' . $this->id), '/');
409
+        return rtrim($this->getProject()->getUrlForPage('Special:Diff/'.$this->id), '/');
410 410
     }
411 411
 
412 412
     /**
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      */
416 416
     public function getPermaUrl(): string
417 417
     {
418
-        return rtrim($this->getProject()->getUrlForPage('Special:PermaLink/' . $this->id), '/');
418
+        return rtrim($this->getProject()->getUrlForPage('Special:PermaLink/'.$this->id), '/');
419 419
     }
420 420
 
421 421
     /**
Please login to merge, or discard this patch.
src/Controller/GlobalContribsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Controller;
6 6
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $this->project = $defaultProject;
231 231
 
232 232
         $results = $globalContribs->globalEdits();
233
-        $results = array_map(function (Edit $edit) {
233
+        $results = array_map(function(Edit $edit) {
234 234
             return $edit->getForJson(true);
235 235
         }, array_values($results));
236 236
         $results = $this->addFullPageTitlesAndContinue('globalcontribs', [], $results);
Please login to merge, or discard this patch.
src/Controller/TopEditsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         // Send all to the template.
178 178
         return $this->getFormattedResponse('topedits/result_page', [
179 179
             'xtPage' => 'TopEdits',
180
-            'xtTitle' => $this->user->getUsername() . ' - ' . $this->page->getTitle(),
180
+            'xtTitle' => $this->user->getUsername().' - '.$this->page->getTitle(),
181 181
             'te' => $topEdits,
182 182
         ]);
183 183
     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         $topEdits->prepareData();
316 316
 
317 317
         return $this->getFormattedApiResponse([
318
-            'top_edits' => array_map(function (Edit $edit) {
318
+            'top_edits' => array_map(function(Edit $edit) {
319 319
                 return $edit->getForJson();
320 320
             }, $topEdits->getTopEdits()),
321 321
         ]);
Please login to merge, or discard this patch.
src/Model/AutoEdits.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Model;
6 6
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         );
178 178
 
179 179
         if ($forJson) {
180
-            return array_map(function (Edit $edit) {
180
+            return array_map(function(Edit $edit) {
181 181
                 return $edit->getForJson();
182 182
             }, $this->nonAutomatedEdits);
183 183
         }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         );
218 218
 
219 219
         if ($forJson) {
220
-            return array_map(function (Edit $edit) {
220
+            return array_map(function(Edit $edit) {
221 221
                 return $edit->getForJson();
222 222
             }, $this->automatedEdits);
223 223
         }
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
     public function getToolsTotal(): int
270 270
     {
271 271
         if (!isset($this->toolsTotal)) {
272
-            $this->toolsTotal = array_reduce($this->getToolCounts(), function ($a, $b) {
273
-                return $a + $b['count'];
272
+            $this->toolsTotal = array_reduce($this->getToolCounts(), function($a, $b) {
273
+                return $a+$b['count'];
274 274
             });
275 275
         }
276 276
 
Please login to merge, or discard this patch.
src/Controller/DefaultController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         string $centralAuthProject
68 68
     ): RedirectResponse {
69 69
         try {
70
-            [ $next, $token ] = $this->getOauthClient($request, $projectRepo, $centralAuthProject)->initiate();
70
+            [$next, $token] = $this->getOauthClient($request, $projectRepo, $centralAuthProject)->initiate();
71 71
         } catch (Exception $oauthException) {
72 72
             $this->addFlashMessage('notice', 'error-login');
73 73
             return $this->redirectToRoute('homepage');
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     . '?title=Special:OAuth';
155 155
         $conf = new ClientConfig($endpoint);
156 156
         $consumerKey = $this->getParameter('oauth_key');
157
-        $consumerSecret =  $this->getParameter('oauth_secret');
157
+        $consumerSecret = $this->getParameter('oauth_secret');
158 158
         $conf->setConsumer(new Consumer($consumerKey, $consumerSecret));
159 159
         $this->oauthClient = new Client($conf);
160 160
 
Please login to merge, or discard this patch.