Completed
Pull Request — master (#107)
by Matthew
02:18
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/AdminStatsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@
 block discarded – undo
176 176
 
177 177
         // Iterate over query results, loading each user id into the array
178 178
         while ($row = $res->fetch()) {
179
-            $adminIdArr[] = $row["user_id"] ;
179
+            $adminIdArr[] = $row["user_id"];
180 180
         }
181 181
 
182 182
         // Set the query results to be useful in a sql statement.
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/AppBundle/Controller/DefaultController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     public function loginAction()
91 91
     {
92 92
         try {
93
-            list( $next, $token ) = $this->getOauthClient()->initiate();
93
+            list($next, $token) = $this->getOauthClient()->initiate();
94 94
         } catch (Exception $oauthException) {
95 95
             throw $oauthException;
96 96
             // @TODO Make this work.
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                     . '/index.php?title=Special:OAuth';
156 156
         $conf = new ClientConfig($endpoint);
157 157
         $consumerKey = $this->getParameter('oauth_key');
158
-        $consumerSecret =  $this->getParameter('oauth_secret');
158
+        $consumerSecret = $this->getParameter('oauth_secret');
159 159
         $conf->setConsumer(new Consumer($consumerKey, $consumerSecret));
160 160
         $this->oauthClient = new Client($conf);
161 161
         // Callback URL is hardcoded in the consumer registration.
Please login to merge, or discard this patch.
src/AppBundle/Helper/ApiHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     public function groups($project, $username)
66 66
     {
67 67
         $this->setUp($project);
68
-        $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ];
68
+        $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"];
69 69
         $query = new SimpleRequest('query', $params);
70 70
         $result = [];
71 71
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function globalGroups($project, $username)
92 92
     {
93 93
         $this->setUp($project);
94
-        $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ];
94
+        $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"];
95 95
         $query = new SimpleRequest('query', $params);
96 96
         $result = [];
97 97
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                 $groups[] = "B";
142 142
             }
143 143
             if (in_array("steward", $admin["groups"])) {
144
-                $groups[] = "S" ;
144
+                $groups[] = "S";
145 145
             }
146 146
             if (in_array("checkuser", $admin["groups"])) {
147 147
                 $groups[] = "CU";
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             if (in_array("bot", $admin["groups"])) {
153 153
                 $groups[] = "Bot";
154 154
             }
155
-            $result[ $admin["name"] ] = [
155
+            $result[$admin["name"]] = [
156 156
                 "groups" => implode('/', $groups)
157 157
             ];
158 158
         }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             $normalized = [];
228 228
             if (isset($result['query']['normalized'])) {
229 229
                 array_map(
230
-                    function ($e) use (&$normalized) {
230
+                    function($e) use (&$normalized) {
231 231
                         $normalized[$e['to']] = $e['from'];
232 232
                     },
233 233
                     $result['query']['normalized']
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         $query = FluentRequest::factory()->setAction('query')->setParams($requestData);
313 313
         $innerPromise = $this->api->getRequestAsync($query);
314 314
 
315
-        $innerPromise->then(function ($result) use (&$data) {
315
+        $innerPromise->then(function($result) use (&$data) {
316 316
             // some failures come back as 200s, so we still resolve and let the outer function handle it
317 317
             if (isset($result['error']) || !isset($result['query'])) {
318 318
                 return $data['promise']->resolve($data);
Please login to merge, or discard this patch.
src/AppBundle/Controller/SimpleEditCounterController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
         // If we've got a project and user, redirect to results.
50 50
         if ($projectName != '' && $username != '') {
51
-            $routeParams = [ 'project' => $projectName, 'username' => $username ];
51
+            $routeParams = ['project' => $projectName, 'username' => $username];
52 52
             return $this->redirectToRoute('SimpleEditCounterResult', $routeParams);
53 53
         }
54 54
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
         $resultQuery->execute();
121 121
 
122 122
         if ($resultQuery->errorCode() > 0) {
123
-            $this->addFlash('notice', [ 'no-result', $username ]);
124
-            return $this->redirectToRoute('SimpleEditCounterProject', [ 'project' => $project->getDomain() ]);
123
+            $this->addFlash('notice', ['no-result', $username]);
124
+            return $this->redirectToRoute('SimpleEditCounterProject', ['project' => $project->getDomain()]);
125 125
         }
126 126
 
127 127
         // Fetch the result data
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
                 $rev = $row['value'];
146 146
             }
147 147
             if ($row['source'] == 'groups') {
148
-                $groups .= $row['value']. ', ';
148
+                $groups .= $row['value'].', ';
149 149
             }
150 150
         }
151 151
 
152 152
         // Unknown user - If the user is created the $results variable will have 3 entries.
153 153
         // This is a workaround to detect non-existent IPs.
154 154
         if (count($results) < 3 && $arch == 0 && $rev == 0) {
155
-            $this->addFlash('notice', [ 'no-result', $username ]);
155
+            $this->addFlash('notice', ['no-result', $username]);
156 156
 
157
-            return $this->redirectToRoute('SimpleEditCounterProject', [ 'project' => $project->getDomain() ]);
157
+            return $this->redirectToRoute('SimpleEditCounterProject', ['project' => $project->getDomain()]);
158 158
         }
159 159
 
160 160
         // Remove the last comma and space
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             'project' => $project,
184 184
             'id' => $id,
185 185
             'arch' => $arch,
186
-            'rev' => $rev + $arch,
186
+            'rev' => $rev+$arch,
187 187
             'live' => $rev,
188 188
             'groups' => $groups,
189 189
             'globalGroups' => $globalGroups,
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
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
         // $tableExtension in order to generate the new table name
151 151
         if ($this->isLabs() && $tableExtension !== null) {
152 152
             $mapped = true;
153
-            $tableName = $tableName . '_' . $tableExtension;
153
+            $tableName = $tableName.'_'.$tableExtension;
154 154
         } elseif ($this->container->hasParameter("app.table.$tableName")) {
155 155
             // Use the table specified in the table mapping configuration, if present.
156 156
             $mapped = true;
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/AppBundle/Controller/PagesController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 'username' => $username,
79 79
             ]);
80 80
         } elseif ($projectQuery != "") {
81
-            return $this->redirectToRoute("PagesProject", [ 'project'=>$projectQuery ]);
81
+            return $this->redirectToRoute("PagesProject", ['project'=>$projectQuery]);
82 82
         }
83 83
 
84 84
         // set default wiki so we can populate the namespace selector
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
         }
208 208
 
209 209
         if ($total < 1) {
210
-            $this->addFlash('notice', [ 'no-result', $username ]);
211
-            return $this->redirectToRoute('PagesProject', [ 'project' => $project ]);
210
+            $this->addFlash('notice', ['no-result', $username]);
211
+            return $this->redirectToRoute('PagesProject', ['project' => $project]);
212 212
         }
213 213
 
214 214
         ksort($pagesByNamespaceByDate);
Please login to merge, or discard this patch.