Passed
Push — main ( 4c5db7...f23a69 )
by MusikAnimal
03:09
created
src/Helper/AutomatedEditsHelper.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\Helper;
6 6
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
             return $this->cache->getItem($cacheKey)->get();
80 80
         }
81 81
 
82
-        $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title=' .
83
-            'MediaWiki:XTools-AutoEdits.json' . ($useSandbox ? '/sandbox' : '');
82
+        $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title='.
83
+            'MediaWiki:XTools-AutoEdits.json'.($useSandbox ? '/sandbox' : '');
84 84
 
85 85
         if ($useSandbox && $this->session->get('logged_in_user')) {
86 86
             // Request via OAuth to get around server-side caching.
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
         // Once last walk through for some tidying up and validation.
145 145
         $invalid = [];
146
-        array_walk($this->tools[$projectDomain], function (&$data, $tool) use (&$invalid): void {
146
+        array_walk($this->tools[$projectDomain], function(&$data, $tool) use (&$invalid): void {
147 147
             // Populate the 'label' with the tool name, if a label doesn't already exist.
148 148
             $data['label'] = $data['label'] ?? $tool;
149 149
 
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 
228 228
         $revertEntries = array_filter(
229 229
             $this->getTools($project),
230
-            function ($tool) {
230
+            function($tool) {
231 231
                 return isset($tool['revert']) && isset($tool['regex']);
232 232
             }
233 233
         );
234 234
 
235 235
         // If 'revert' is set to `true`, then use 'regex' as the regular expression,
236 236
         //  otherwise 'revert' is assumed to be the regex string.
237
-        $this->revertTools[$projectDomain] = array_map(function ($revertTool) {
237
+        $this->revertTools[$projectDomain] = array_map(function($revertTool) {
238 238
             return [
239 239
                 'link' => $revertTool['link'],
240 240
                 'regex' => true === $revertTool['revert'] ? $revertTool['regex'] : $revertTool['revert'],
Please login to merge, or discard this patch.
config/preload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 if (file_exists(dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php')) {
6 6
     require dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php';
Please login to merge, or discard this patch.
migrations/Version20170623203059.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace DoctrineMigrations;
6 6
 
Please login to merge, or discard this patch.
migrations/Version20171208040821.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace DoctrineMigrations;
6 6
 
Please login to merge, or discard this patch.
migrations/Version20170623205224.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace DoctrineMigrations;
6 6
 
Please login to merge, or discard this patch.
src/Model/User.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
 
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
             $firstAddrUnpacked = unpack('H*', $firstAddrBin);
127 127
             $firstAddrHex = reset($firstAddrUnpacked);
128 128
             $range[0] = inet_ntop($firstAddrBin);
129
-            $flexBits = 128 - $prefixLen;
129
+            $flexBits = 128-$prefixLen;
130 130
             $lastAddrHex = $firstAddrHex;
131 131
 
132 132
             $pos = 31;
133 133
             while ($flexBits > 0) {
134 134
                 $orig = substr($lastAddrHex, $pos, 1);
135 135
                 $origVal = hexdec($orig);
136
-                $newVal = $origVal | (pow(2, min(4, $flexBits)) - 1);
136
+                $newVal = $origVal | (pow(2, min(4, $flexBits))-1);
137 137
                 $new = dechex($newVal);
138 138
                 $lastAddrHex = substr_replace($lastAddrHex, $new, $pos, 1);
139 139
                 $flexBits -= 4;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
             $range[1] = inet_ntop($lastAddrBin);
145 145
         } else {
146 146
             $cidr = explode('/', $this->username);
147
-            $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32 - (int)$cidr[1]));
148
-            $range[1] = long2ip(ip2long($range[0]) + pow(2, (32 - (int)$cidr[1])) - 1);
147
+            $range[0] = long2ip(ip2long($cidr[0]) & -1 << (32-(int)$cidr[1]));
148
+            $range[1] = long2ip(ip2long($range[0])+pow(2, (32-(int)$cidr[1]))-1);
149 149
         }
150 150
 
151 151
         // Find the leftmost common characters between the two addresses.
Please login to merge, or discard this patch.
src/Model/ArticleInfo.php 1 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/Controller/MetaController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $timeline = [];
105 105
         $startObj = new DateTime($start);
106 106
         $endObj = new DateTime($end);
107
-        $numDays = (int) $endObj->diff($startObj)->format("%a");
107
+        $numDays = (int)$endObj->diff($startObj)->format("%a");
108 108
         $grandSum = 0;
109 109
 
110 110
         // Generate array of date labels
@@ -114,17 +114,17 @@  discard block
 block discarded – undo
114 114
 
115 115
         foreach ($data as $entry) {
116 116
             if (!isset($totals[$entry['tool']])) {
117
-                $totals[$entry['tool']] = (int) $entry['count'];
117
+                $totals[$entry['tool']] = (int)$entry['count'];
118 118
 
119 119
                 // Create arrays for each tool, filled with zeros for each date in the timeline
120 120
                 $timeline[$entry['tool']] = array_fill(0, $numDays, 0);
121 121
             } else {
122
-                $totals[$entry['tool']] += (int) $entry['count'];
122
+                $totals[$entry['tool']] += (int)$entry['count'];
123 123
             }
124 124
 
125 125
             $date = new DateTime($entry['date']);
126
-            $dateIndex = (int) $date->diff($startObj)->format("%a");
127
-            $timeline[$entry['tool']][$dateIndex] = (int) $entry['count'];
126
+            $dateIndex = (int)$date->diff($startObj)->format("%a");
127
+            $timeline[$entry['tool']][$dateIndex] = (int)$entry['count'];
128 128
 
129 129
             $grandSum += $entry['count'];
130 130
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $timeline = [];
160 160
         $startObj = new DateTime($start);
161 161
         $endObj = new DateTime($end);
162
-        $numDays = (int) $endObj->diff($startObj)->format("%a");
162
+        $numDays = (int)$endObj->diff($startObj)->format("%a");
163 163
         $grandSum = 0;
164 164
 
165 165
         // Generate array of date labels
@@ -169,17 +169,17 @@  discard block
 block discarded – undo
169 169
 
170 170
         foreach ($data as $entry) {
171 171
             if (!isset($totals[$entry['endpoint']])) {
172
-                $totals[$entry['endpoint']] = (int) $entry['count'];
172
+                $totals[$entry['endpoint']] = (int)$entry['count'];
173 173
 
174 174
                 // Create arrays for each endpoint, filled with zeros for each date in the timeline
175 175
                 $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0);
176 176
             } else {
177
-                $totals[$entry['endpoint']] += (int) $entry['count'];
177
+                $totals[$entry['endpoint']] += (int)$entry['count'];
178 178
             }
179 179
 
180 180
             $date = new DateTime($entry['date']);
181
-            $dateIndex = (int) $date->diff($startObj)->format("%a");
182
-            $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count'];
181
+            $dateIndex = (int)$date->diff($startObj)->format("%a");
182
+            $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count'];
183 183
 
184 184
             $grandSum += $entry['count'];
185 185
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
         /** @var Connection $conn */
241 241
         $conn = $managerRegistry->getConnection('default');
242
-        $date =  date('Y-m-d');
242
+        $date = date('Y-m-d');
243 243
 
244 244
         // Tool name needs to be lowercase.
245 245
         $tool = strtolower($tool);
Please login to merge, or discard this patch.
src/Exception/BadGatewayException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace App\Exception;
6 6
 
Please login to merge, or discard this patch.