Cancelled
Pull Request — master (#149)
by Albert
05:31
created
web/app_dev.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 // Feel free to remove this, extend it, or make something more sophisticated.
13 13
 if (isset($_SERVER['HTTP_CLIENT_IP'])
14 14
     || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
15
-    || !( in_array(@$_SERVER['REMOTE_ADDR'], [ '127.0.0.1', 'fe80::1', '::1' ]) || php_sapi_name() === 'cli-server' )
15
+    || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
16 16
 ) {
17 17
     header('HTTP/1.0 403 Forbidden');
18 18
     exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
Please login to merge, or discard this patch.
src/AppBundle/Controller/QuoteController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             'quote/all.html.twig',
112 112
             [
113 113
                 'base_dir' => realpath(
114
-                    $this->getParameter('kernel.root_dir') . '/..'
114
+                    $this->getParameter('kernel.root_dir').'/..'
115 115
                 ),
116 116
                 'xtPage' => 'bash',
117 117
                 'quotes' => $quotes,
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             'quote/view.html.twig',
161 161
             [
162 162
                 'base_dir' => realpath(
163
-                    $this->getParameter('kernel.root_dir') . '/..'
163
+                    $this->getParameter('kernel.root_dir').'/..'
164 164
                 ),
165 165
                 "xtPage" => "bash",
166 166
                 "text" => $text,
Please login to merge, or discard this patch.
src/Xtools/Project.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getUrl($withTrailingSlash = true)
119 119
     {
120
-        return rtrim($this->getBasicInfo()['url'], '/') . ($withTrailingSlash ? '/' : '');
120
+        return rtrim($this->getBasicInfo()['url'], '/').($withTrailingSlash ? '/' : '');
121 121
     }
122 122
 
123 123
     /**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $metadata = $this->getMetadata();
175 175
         return isset($metadata['general']['script'])
176 176
             ? $metadata['general']['script']
177
-            : $this->getScriptPath() . '/index.php';
177
+            : $this->getScriptPath().'/index.php';
178 178
     }
179 179
 
180 180
     /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function getApiUrl()
186 186
     {
187
-        return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath();
187
+        return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath();
188 188
     }
189 189
 
190 190
     /**
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function userOptInPage(User $user)
218 218
     {
219
-        $localPageName = 'User:' . $user->getUsername() . '/EditCounterOptIn.js';
219
+        $localPageName = 'User:'.$user->getUsername().'/EditCounterOptIn.js';
220 220
         return $localPageName;
221 221
     }
222 222
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         }
251 251
 
252 252
         // 4. Lastly, see if they've opted in globally on the default project or Meta.
253
-        $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js';
253
+        $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js';
254 254
         $globalProject = $this->getRepository()->getGlobalProject();
255 255
         if ($globalProject instanceof Project) {
256 256
             $globalExists = $globalProject->getRepository()
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      */
270 270
     public function hasPageAssessments()
271 271
     {
272
-        return (bool) $this->getRepository()->getAssessmentsConfig($this->getDomain());
272
+        return (bool)$this->getRepository()->getAssessmentsConfig($this->getDomain());
273 273
     }
274 274
 
275 275
     /**
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
         $config = $this->getRepository()->getAssessmentsConfig($this->getDomain());
283 283
 
284 284
         if (isset($config['class'][$class])) {
285
-            return "https://upload.wikimedia.org/wikipedia/commons/" . $config['class'][$class]['badge'];
285
+            return "https://upload.wikimedia.org/wikipedia/commons/".$config['class'][$class]['badge'];
286 286
         } elseif (isset($config['class']['Unknown'])) {
287
-            return "https://upload.wikimedia.org/wikipedia/commons/" . $config['class']['Unknown']['badge'];
287
+            return "https://upload.wikimedia.org/wikipedia/commons/".$config['class']['Unknown']['badge'];
288 288
         } else {
289 289
             return "";
290 290
         }
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
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
         $resultQuery->execute();
147 147
         $results = $resultQuery->fetchAll();
148 148
         $logCounts = array_combine(
149
-            array_map(function ($e) {
149
+            array_map(function($e) {
150 150
                 return $e['source'];
151 151
             }, $results),
152
-            array_map(function ($e) {
152
+            array_map(function($e) {
153 153
                 return $e['value'];
154 154
             }, $results)
155 155
         );
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
         $resultQuery->bindParam(":id", $userId);
367 367
         $resultQuery->execute();
368 368
         $results = $resultQuery->fetchAll();
369
-        $namespaceTotals = array_combine(array_map(function ($e) {
369
+        $namespaceTotals = array_combine(array_map(function($e) {
370 370
             return $e['page_namespace'];
371
-        }, $results), array_map(function ($e) {
371
+        }, $results), array_map(function($e) {
372 372
             return $e['total'];
373 373
         }, $results));
374 374
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             }
428 428
             $queries[] = $sql;
429 429
         }
430
-        $sql = "(\n" . join("\n) UNION (\n", $queries) . ")\n";
430
+        $sql = "(\n".join("\n) UNION (\n", $queries).")\n";
431 431
         $resultQuery = $this->getProjectsConnection()->prepare($sql);
432 432
         $resultQuery->bindParam(":username", $username);
433 433
         $resultQuery->execute();
Please login to merge, or discard this patch.
src/AppBundle/Helper/AutomatedEditsHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function isAutomated($summary, $projectDomain)
59 59
     {
60
-        return (bool) $this->getTool($summary, $projectDomain);
60
+        return (bool)$this->getTool($summary, $projectDomain);
61 61
     }
62 62
 
63 63
     /**
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 
110 110
         $revertEntries = array_filter(
111 111
             $this->getTools($projectDomain),
112
-            function ($tool) {
112
+            function($tool) {
113 113
                 return isset($tool['revert']);
114 114
             }
115 115
         );
116 116
 
117 117
         // If 'revert' is set to `true`, the use 'regex' as the regular expression,
118 118
         //  otherwise 'revert' is assumed to be the regex string.
119
-        $this->revertTools[$projectDomain] = array_map(function ($revertTool) {
119
+        $this->revertTools[$projectDomain] = array_map(function($revertTool) {
120 120
             return [
121 121
                 'link' => $revertTool['link'],
122 122
                 'regex' => $revertTool['revert'] === true ? $revertTool['regex'] : $revertTool['revert']
Please login to merge, or discard this patch.
src/AppBundle/EventSubscriber/RateLimitSubscriber.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function onKernelController(FilterControllerEvent $event)
58 58
     {
59
-        $this->rateLimit = (int) $this->container->getParameter('app.rate_limit_count');
60
-        $this->rateDuration = (int) $this->container->getParameter('app.rate_limit_time');
59
+        $this->rateLimit = (int)$this->container->getParameter('app.rate_limit_count');
60
+        $this->rateDuration = (int)$this->container->getParameter('app.rate_limit_time');
61 61
 
62 62
         // Zero values indicate the rate limiting feature should be disabled.
63 63
         if ($this->rateLimit === 0 || $this->rateDuration === 0) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         }
66 66
 
67 67
         $controller = $event->getController();
68
-        $loggedIn = (bool) $this->container->get('session')->get('logged_in_user');
68
+        $loggedIn = (bool)$this->container->get('session')->get('logged_in_user');
69 69
 
70 70
         /**
71 71
          * Rate limiting will not apply to these actions
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $cacheItem = $cache->getItem($cacheKey);
92 92
 
93 93
         // If increment value already in cache, or start with 1.
94
-        $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1;
94
+        $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1;
95 95
 
96 96
         // Check if limit has been exceeded, and if so, throw an error.
97 97
         if ($count > $this->rateLimit) {
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
         // Log the denied request
144 144
         $logger = $this->container->get('monolog.logger.rate_limit');
145 145
         $logger->info(
146
-            "<URI>: " . $request->getRequestUri() .
147
-            ($logComment != '' ? "\t<Reason>: $logComment" : '') .
148
-            "\t<User agent>: " . $request->headers->get('User-Agent')
146
+            "<URI>: ".$request->getRequestUri().
147
+            ($logComment != '' ? "\t<Reason>: $logComment" : '').
148
+            "\t<User agent>: ".$request->headers->get('User-Agent')
149 149
         );
150 150
 
151
-        throw new AccessDeniedHttpException("Possible spider crawl detected. " .
152
-            'If you are human, you are making too many requests during a short period of time. ' .
153
-            "Please wait $this->rateDuration minutes before reloading this tool. You can then " .
151
+        throw new AccessDeniedHttpException("Possible spider crawl detected. ".
152
+            'If you are human, you are making too many requests during a short period of time. '.
153
+            "Please wait $this->rateDuration minutes before reloading this tool. You can then ".
154 154
             'login to prevent this from happening again.');
155 155
     }
156 156
 }
Please login to merge, or discard this patch.
src/Xtools/RFX.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             }
120 120
         }
121 121
 
122
-        $final = [];    // initialize the final array
122
+        $final = []; // initialize the final array
123 123
         $finalRaw = []; // Initialize the raw data array
124 124
 
125 125
         foreach ($this->data as $key => $value) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         $final = array_count_values($final); // find repetition and its count
134 134
 
135
-        $final = array_diff($final, [1]);    // remove single occurrences
135
+        $final = array_diff($final, [1]); // remove single occurrences
136 136
 
137 137
         $this->duplicates = array_keys($final);
138 138
     }
Please login to merge, or discard this patch.
src/AppBundle/Controller/RfXVoteCalculatorController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $username = $request->query->get('username');
49 49
 
50 50
         if ($projectQuery != '' && $username != '') {
51
-            $routeParams = [ 'project' => $projectQuery, 'username' => $username ];
51
+            $routeParams = ['project' => $projectQuery, 'username' => $username];
52 52
             return $this->redirectToRoute(
53 53
                 'rfxvoteResult',
54 54
                 $routeParams
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
             $titles = [];
168 168
 
169 169
             while ($row = $sth->fetch()) {
170
-                $titles[] = $namespaces[$row['page_namespace']] .
171
-                    ':' .$row['page_title'];
170
+                $titles[] = $namespaces[$row['page_namespace']].
171
+                    ':'.$row['page_title'];
172 172
             }
173 173
 
174 174
             // Chunking... it's possible to make a URI too long
Please login to merge, or discard this patch.
src/AppBundle/Controller/RfXAnalysisController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
         $neutral = $rfx->getSection('neutral');
167 167
         $dup = $rfx->getDuplicates();
168 168
 
169
-        $total = count($support) + count($oppose) + count($neutral);
169
+        $total = count($support)+count($oppose)+count($neutral);
170 170
 
171 171
         if ($total === 0) {
172 172
             $this->addFlash('notice', ['no-result', $pagename]);
Please login to merge, or discard this patch.