Completed
Pull Request — master (#34)
by Sam
03:28
created
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/Helper/ApiHelper.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace AppBundle\Helper;
4 4
 
5
-use DateInterval;
6 5
 use Mediawiki\Api\MediawikiApi;
7 6
 use Mediawiki\Api\SimpleRequest;
8 7
 use Mediawiki\Api\FluentRequest;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             $apiPath = $this->container->getParameter('api_path');
40 40
 
41 41
             try {
42
-                $this->api = MediawikiApi::newFromApiEndpoint($normalizedProject . $apiPath);
42
+                $this->api = MediawikiApi::newFromApiEndpoint($normalizedProject.$apiPath);
43 43
             } catch (Exception $e) {
44 44
                 // Do nothing...
45 45
             } catch (FatalErrorException $e) {
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
             throw new Exception("Unable to find project '$project'");
69 69
         }
70 70
 
71
-        $cacheKey = "siteinfo." . str_replace('/', '_', $normalizedProject);
71
+        $cacheKey = "siteinfo.".str_replace('/', '_', $normalizedProject);
72 72
         if ($this->cacheHas($cacheKey)) {
73 73
             return $this->cacheGet($cacheKey);
74 74
         }
75 75
 
76 76
         $this->setUp($normalizedProject);
77
-        $params = [ 'meta'=>'siteinfo', 'siprop'=>'general|namespaces' ];
77
+        $params = ['meta'=>'siteinfo', 'siprop'=>'general|namespaces'];
78 78
         $query = new SimpleRequest('query', $params);
79 79
 
80 80
         $result = [
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public function groups($project, $username)
139 139
     {
140 140
         $this->setUp($project);
141
-        $params = [ "list"=>"users", "ususers"=>$username, "usprop"=>"groups" ];
141
+        $params = ["list"=>"users", "ususers"=>$username, "usprop"=>"groups"];
142 142
         $query = new SimpleRequest('query', $params);
143 143
         $result = [];
144 144
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     public function globalGroups($project, $username)
158 158
     {
159 159
         $this->setUp($project);
160
-        $params = [ "meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups" ];
160
+        $params = ["meta"=>"globaluserinfo", "guiuser"=>$username, "guiprop"=>"groups"];
161 161
         $query = new SimpleRequest('query', $params);
162 162
         $result = [];
163 163
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                 $groups[] = "B";
206 206
             }
207 207
             if (in_array("steward", $admin["groups"])) {
208
-                $groups[] = "S" ;
208
+                $groups[] = "S";
209 209
             }
210 210
             if (in_array("checkuser", $admin["groups"])) {
211 211
                 $groups[] = "CU";
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             if (in_array("bot", $admin["groups"])) {
217 217
                 $groups[] = "Bot";
218 218
             }
219
-            $result[ $admin["name"] ] = [
219
+            $result[$admin["name"]] = [
220 220
                 "groups" => implode('/', $groups)
221 221
             ];
222 222
         }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
             $normalized = [];
292 292
             if (isset($result['query']['normalized'])) {
293 293
                 array_map(
294
-                    function ($e) use (&$normalized) {
294
+                    function($e) use (&$normalized) {
295 295
                         $normalized[$e['to']] = $e['from'];
296 296
                     },
297 297
                     $result['query']['normalized']
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         ];
338 338
 
339 339
         // get assessments for this page from the API
340
-        $assessments = $this->massApi($params, $project, function ($data) {
340
+        $assessments = $this->massApi($params, $project, function($data) {
341 341
             return isset($data['pages'][0]['pageassessments']) ? $data['pages'][0]['pageassessments'] : [];
342 342
         }, 'pacontinue')['pages'];
343 343
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                 $classAttrs = $config['class']['Unknown'];
362 362
                 $assessment['class']['value'] = '???';
363 363
                 $assessment['class']['category'] = $classAttrs['category'];
364
-                $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/". $classAttrs['badge'];
364
+                $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".$classAttrs['badge'];
365 365
             } else {
366 366
                 $classAttrs = $config['class'][$classValue];
367 367
                 $assessment['class'] = [
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
                 // add full URL to badge icon
374 374
                 if ($classAttrs['badge'] !== '') {
375
-                    $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/" .
375
+                    $assessment['class']['badge'] = "https://upload.wikimedia.org/wikipedia/commons/".
376 376
                         $classAttrs['badge'];
377 377
                 }
378 378
 
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
         $config = $this->getAssessmentsConfig();
422 422
 
423 423
         if (isset($config[$project]['class'][$class])) {
424
-            return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class'][$class]['badge'];
424
+            return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class'][$class]['badge'];
425 425
         } elseif (isset($config[$project]['class']['Unknown'])) {
426
-            return "https://upload.wikimedia.org/wikipedia/commons/" . $config[$project]['class']['Unknown']['badge'];
426
+            return "https://upload.wikimedia.org/wikipedia/commons/".$config[$project]['class']['Unknown']['badge'];
427 427
         } else {
428 428
             return "";
429 429
         }
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
         $query = FluentRequest::factory()->setAction('query')->setParams($requestData);
517 517
         $innerPromise = $this->api->getRequestAsync($query);
518 518
 
519
-        $innerPromise->then(function ($result) use (&$data) {
519
+        $innerPromise->then(function($result) use (&$data) {
520 520
             // some failures come back as 200s, so we still resolve and let the outer function handle it
521 521
             if (isset($result['error']) || !isset($result['query'])) {
522 522
                 return $data['promise']->resolve($data);
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
      * Get a list of namespaces on the given project.
178 178
      *
179 179
      * @param string    $project such as en.wikipedia.org
180
-     * @return string[] Array of namespace IDs (keys) to names (values).
180
+     * @return string Array of namespace IDs (keys) to names (values).
181 181
      */
182 182
     public function namespaces($project)
183 183
     {
Please login to merge, or discard this patch.
src/AppBundle/Helper/LabsHelper.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Symfony\Component\Config\Definition\Exception\Exception;
6 6
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
7 7
 use Symfony\Component\DependencyInjection\ContainerInterface;
8
-use Symfony\Component\VarDumper\VarDumper;
9 8
 
10 9
 class LabsHelper
11 10
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         $this->dbName = $dbName;
72 72
         $this->url = $url;
73 73
 
74
-        return [ 'dbName' => $dbName, 'wikiName' => $wikiName, 'url' => $url, 'lang' => $lang ];
74
+        return ['dbName' => $dbName, 'wikiName' => $wikiName, 'url' => $url, 'lang' => $lang];
75 75
     }
76 76
 
77 77
     /**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         // Create the query we're going to run against the meta database
110 110
         $wikiQuery = $this->client->createQueryBuilder();
111 111
         $wikiQuery
112
-            ->select([ 'dbname', 'name', 'url', 'lang' ])
112
+            ->select(['dbname', 'name', 'url', 'lang'])
113 113
             ->from('wiki')
114 114
             ->where($wikiQuery->expr()->eq('dbname', ':project'))
115 115
             // The meta database will have the project's URL stored as https://en.wikipedia.org
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public function allProjects()
161 161
     {
162 162
         $wikiQuery = $this->client->createQueryBuilder();
163
-        $wikiQuery->select([ 'dbName', 'name', 'url' ])->from('wiki');
163
+        $wikiQuery->select(['dbName', 'name', 'url'])->from('wiki');
164 164
         $stmt = $wikiQuery->execute();
165 165
         $out = $stmt->fetchAll();
166 166
         return $out;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         // as required by Labs.  We combine $table with
184 184
         // $table_extension in order to generate the new table name
185 185
         if ($this->isLabs() && $table_extension !== null) {
186
-            $table = $table . "_" . $table_extension;
186
+            $table = $table."_".$table_extension;
187 187
         }
188 188
 
189 189
         // Use the table specified in the table mapping configuration, if present.
Please login to merge, or discard this patch.
src/AppBundle/Controller/QuoteController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6 6
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7
-use Symfony\Component\Debug\Exception\ContextErrorException;
8 7
 use Symfony\Component\Routing\Exception\InvalidParameterException;
9 8
 use Symfony\Component\HttpFoundation\Request;
10 9
 
Please login to merge, or discard this 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/AutomatedEditsController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6 6
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7 7
 use Symfony\Component\HttpFoundation\Request;
8
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9 8
 
10 9
 class AutomatedEditsController extends Controller
11 10
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
         $archiveTable = $lh->getTable("archive", $dbName);
156 156
 
157 157
         $cond_begin = $start ? " AND rev_timestamp > :start " : null;
158
-        $cond_end = $end ? " AND rev_timestamp < :end ": null;
158
+        $cond_end = $end ? " AND rev_timestamp < :end " : null;
159 159
 
160 160
         foreach ($AEBTypes as $toolname => $check) {
161 161
             $toolname = $dbh->quote($toolname, \PDO::PARAM_STR);
Please login to merge, or discard this patch.
src/Xtools/Project.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
     /** @var string[] Basic metadata about the project */
15 15
     protected $metadata;
16 16
 
17
+    /**
18
+     * @param string $nameOrUrl
19
+     */
17 20
     public function __construct($nameOrUrl)
18 21
     {
19 22
         $this->nameUnnormalized = $nameOrUrl;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
      */
56 56
     public function getUrl()
57 57
     {
58
-        return rtrim($this->getMetadata()['url'], '/') . '/';
58
+        return rtrim($this->getMetadata()['url'], '/').'/';
59 59
     }
60 60
 
61 61
     /**
Please login to merge, or discard this patch.
src/Xtools/Page.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     /**
54 54
      * Get this page's database ID.
55
-     * @return int
55
+     * @return \string|null
56 56
      */
57 57
     public function getId()
58 58
     {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     }
76 76
 
77 77
     /**
78
-     * @return string
78
+     * @return \string|null
79 79
      */
80 80
     public function getUrl()
81 81
     {
Please login to merge, or discard this patch.
src/Xtools/User.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
     public function userRightsUrl(Project $project)
67 67
     {
68 68
         return $project->getUrl() . $project->getScriptPath() . "?title=Special:UserRights&user=" .
69
-               $this->getUsername();
69
+                $this->getUsername();
70 70
     }
71 71
 
72 72
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
      */
66 66
     public function userRightsUrl(Project $project)
67 67
     {
68
-        return $project->getUrl() . $project->getScriptPath() . "?title=Special:UserRights&user=" .
68
+        return $project->getUrl().$project->getScriptPath()."?title=Special:UserRights&user=".
69 69
                $this->getUsername();
70 70
     }
71 71
 
Please login to merge, or discard this patch.
src/AppBundle/Controller/TopEditsController.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
      * List top edits by this user for all pages in a particular namespace.
97 97
      * @param User $user The User.
98 98
      * @param Project $project The project.
99
-     * @param integer|string $namespaceId The namespace ID or 'all'
99
+     * @param integer $namespaceId The namespace ID or 'all'
100 100
      * @return \Symfony\Component\HttpFoundation\Response
101 101
      */
102 102
     protected function namespaceTopEdits(User $user, Project $project, $namespaceId)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8 8
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9 9
 use Symfony\Component\HttpFoundation\Request;
10
-use Symfony\Component\VarDumper\VarDumper;
11 10
 use Xtools\Page;
12 11
 use Xtools\PagesRepository;
13 12
 use Xtools\Project;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 'username' => $username,
56 56
             ]);
57 57
         } elseif ($projectName != "") {
58
-            return $this->redirectToRoute("TopEditsResults", [ 'project'=>$projectName ]);
58
+            return $this->redirectToRoute("TopEditsResults", ['project'=>$projectName]);
59 59
         }
60 60
 
61 61
         // Set default project so we can populate the namespace selector.
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
         }
132 132
 
133 133
         // Get page info about these 100 pages, so we can use their display title.
134
-        $titles = array_map(function ($e) use ($namespaces) {
134
+        $titles = array_map(function($e) use ($namespaces) {
135 135
             // If non-mainspace, prepend namespace to the titles.
136 136
             $ns = $e['page_namespace'];
137
-            $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']] . ':' : '';
138
-            return $nsTitle . $e['page_title'];
137
+            $nsTitle = $ns > 0 ? $namespaces[$e['page_namespace']].':' : '';
138
+            return $nsTitle.$e['page_title'];
139 139
         }, $editData);
140 140
         /** @var ApiHelper $apiHelper */
141 141
         $apiHelper = $this->get('app.api_helper');
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
         foreach ($editData as $editDatum) {
147 147
             // If non-mainspace, prepend namespace to the titles.
148 148
             $ns = $editDatum['page_namespace'];
149
-            $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']] . ':' : '';
150
-            $pageTitle = $nsTitle . $editDatum['page_title'];
149
+            $nsTitle = $ns > 0 ? $namespaces[$editDatum['page_namespace']].':' : '';
150
+            $pageTitle = $nsTitle.$editDatum['page_title'];
151 151
             $editDatum['displaytitle'] = $displayTitles[$pageTitle];
152 152
             // $editDatum['page_title'] is retained without the namespace
153 153
             //  so we can link to TopEdits for that page
Please login to merge, or discard this patch.