Passed
Push — master ( a1a60b...e6cb36 )
by Matthew
01:24
created
src/AppBundle/Controller/XtoolsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         $params = $this->convertLegacyParams($params);
43 43
 
44 44
         // Remove blank values.
45
-        return array_filter($params, function ($param) {
45
+        return array_filter($params, function($param) {
46 46
             // 'namespace' or 'username' could be '0'.
47 47
             return $param !== null && $param !== '';
48 48
         });
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
@@ -171,7 +171,7 @@
 block discarded – undo
171 171
     public function adminStatsApiAction($project, $days = 30)
172 172
     {
173 173
         // Maximum 30 days.
174
-        $days = min((int) $days, 30);
174
+        $days = min((int)$days, 30);
175 175
         $start = date('Y-m-d', strtotime("-$days days"));
176 176
         $end = date('Y-m-d');
177 177
 
Please login to merge, or discard this patch.
src/Xtools/AdminStatsRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         $userGroupsTable = $project->getTableName('user_groups');
53 53
         $ufgTable = $project->getTableName('user_former_groups');
54 54
 
55
-        $adminGroups = join(array_map(function ($group) {
55
+        $adminGroups = join(array_map(function($group) {
56 56
             return "'$group'";
57 57
         }, $this->getAdminGroups($project)), ',');
58 58
 
Please login to merge, or discard this patch.
src/AppBundle/Controller/ArticleInfoController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
             $rendered = str_replace('"', '\"', trim($rendered));
86 86
 
87 87
             // Uglify temporary file.
88
-            $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js';
88
+            $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js';
89 89
             $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && ";
90
-            $script .= $this->get('kernel')->getRootDir() .
91
-                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " .
90
+            $script .= $this->get('kernel')->getRootDir().
91
+                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ".
92 92
                 "&& rm $tmpFile >/dev/null";
93 93
             $process = new Process($script);
94 94
             $process->run();
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
             $rendered = str_replace('\"', '"', trim($rendered));
108 108
 
109 109
             // Add comment after uglifying since it removes comments.
110
-            $rendered = "/**\n * This code was automatically generated and should not " .
111
-                "be manually edited.\n * For updates, please copy and paste from " .
112
-                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) .
113
-                "\n * Released under GPL v3 license.\n */\n" . $rendered;
110
+            $rendered = "/**\n * This code was automatically generated and should not ".
111
+                "be manually edited.\n * For updates, please copy and paste from ".
112
+                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL).
113
+                "\n * Released under GPL v3 license.\n */\n".$rendered;
114 114
         }
115 115
 
116 116
         $response = new \Symfony\Component\HttpFoundation\Response($rendered);
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
         $info = $page->getBasicEditingInfo();
214 214
         $creationDateTime = DateTime::createFromFormat('YmdHis', $info['created_at']);
215 215
         $modifiedDateTime = DateTime::createFromFormat('YmdHis', $info['modified_at']);
216
-        $secsSinceLastEdit = (new DateTime)->getTimestamp() - $modifiedDateTime->getTimestamp();
216
+        $secsSinceLastEdit = (new DateTime)->getTimestamp()-$modifiedDateTime->getTimestamp();
217 217
 
218 218
         $data = [
219
-            'revisions' => (int) $info['num_edits'],
220
-            'editors' => (int) $info['num_editors'],
219
+            'revisions' => (int)$info['num_edits'],
220
+            'editors' => (int)$info['num_editors'],
221 221
             'author' => $info['author'],
222
-            'author_editcount' => (int) $info['author_editcount'],
222
+            'author_editcount' => (int)$info['author_editcount'],
223 223
             'created_at' => $creationDateTime->format('Y-m-d'),
224 224
             'created_rev_id' => $info['created_rev_id'],
225 225
             'modified_at' => $modifiedDateTime->format('Y-m-d H:i'),
226 226
             'secs_since_last_edit' => $secsSinceLastEdit,
227
-            'last_edit_id' => (int) $info['modified_rev_id'],
228
-            'watchers' => (int) $page->getWatchers(),
227
+            'last_edit_id' => (int)$info['modified_rev_id'],
228
+            'watchers' => (int)$page->getWatchers(),
229 229
             'pageviews' => $page->getLastPageviews($pageviewsOffset),
230 230
             'pageviews_offset' => $pageviewsOffset,
231 231
         ];
Please login to merge, or discard this patch.
src/AppBundle/Controller/ApiController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             $res['automated_editcount'] = $user->countAutomatedEdits($project, $namespace, $start, $end);
132 132
         }
133 133
 
134
-        $res['nonautomated_editcount'] = $res['total_editcount'] - $res['automated_editcount'];
134
+        $res['nonautomated_editcount'] = $res['total_editcount']-$res['automated_editcount'];
135 135
 
136 136
         $view = View::create()->setStatusCode(Response::HTTP_OK);
137 137
         $view->setData($res);
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
             if ($request->query->get('format') !== 'html') {
177 177
                 return new View(
178 178
                     [
179
-                        'error' => 'Unable to show any data. User has made over ' .
180
-                            $user->maxEdits() . ' edits.',
179
+                        'error' => 'Unable to show any data. User has made over '.
180
+                            $user->maxEdits().' edits.',
181 181
                     ],
182 182
                     Response::HTTP_FORBIDDEN
183 183
                 );
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
         if ($request->query->get('format') === 'html') {
194 194
             if ($edits) {
195
-                $edits = array_map(function ($attrs) use ($project, $username) {
195
+                $edits = array_map(function($attrs) use ($project, $username) {
196 196
                     $page = $project->getRepository()
197 197
                         ->getPage($project, $attrs['full_page_title']);
198 198
                     $pageTitles[] = $attrs['full_page_title'];
Please login to merge, or discard this patch.
src/Xtools/PagesRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         // supply as the OFFSET.
149 149
         $limitClause = '';
150 150
         if (intval($limit) > 0 && isset($numRevisions)) {
151
-            $offset = $numRevisions - $limit;
151
+            $offset = $numRevisions-$limit;
152 152
             $limitClause = "LIMIT $offset, $limit";
153 153
         }
154 154
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         $time2 = time();
265 265
 
266 266
         // If it took over 5 seconds, cache the result for 20 minutes.
267
-        if ($time2 - $time1 > 5) {
267
+        if ($time2-$time1 > 5) {
268 268
             $cacheItem = $this->cache->getItem($cacheKey)
269 269
                 ->set($result)
270 270
                 ->expiresAfter(new DateInterval('PT20M'));
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
         $wikidataId = ltrim($page->getWikidataId(), 'Q');
401 401
 
402
-        $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . "
402
+        $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')."
403 403
                 FROM wikidatawiki_p.wb_items_per_site
404 404
                 WHERE ips_item_id = :wikidataId";
405 405
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 
410 410
         $result = $resultQuery->fetchAll();
411 411
 
412
-        return $count ? (int) $result[0]['count'] : $result;
412
+        return $count ? (int)$result[0]['count'] : $result;
413 413
     }
414 414
 
415 415
     /**
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
         // Transform to associative array by 'type'
451 451
         foreach ($res as $row) {
452
-            $data[$row['type'] . '_count'] = $row['value'];
452
+            $data[$row['type'].'_count'] = $row['value'];
453 453
         }
454 454
 
455 455
         return $data;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 
488 488
         $project = $page->getProject()->getDomain();
489 489
 
490
-        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' .
490
+        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'.
491 491
             "$project/all-access/user/$title/daily/$start/$end";
492 492
 
493 493
         $res = $client->request('GET', $url);
Please login to merge, or discard this patch.
src/Xtools/ArticleInfoRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $userGroupsTable = $project->getTableName('user_groups');
23 23
         $userFromerGroupsTable = $project->getTableName('user_former_groups');
24 24
         $sql = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current
25
-                FROM " . $project->getTableName('revision') . "
25
+                FROM " . $project->getTableName('revision')."
26 26
                 LEFT JOIN $userGroupsTable ON rev_user = ug_user
27 27
                 LEFT JOIN $userFromerGroupsTable ON rev_user = ufg_user
28 28
                 WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot')
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $loggingTable = $page->getProject()->getTableName('logging', 'logindex');
45 45
         $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp'
46 46
                 FROM $loggingTable
47
-                WHERE log_namespace = '" . $page->getNamespace() . "'
47
+                WHERE log_namespace = '".$page->getNamespace()."'
48 48
                 AND log_title = :title AND log_timestamp > 1
49 49
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
50 50
         $title = str_replace(' ', '_', $page->getTitle());
Please login to merge, or discard this patch.
src/Xtools/ProjectRepository.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                     || $projMetadata['url'] == "https://$project"
150 150
                     || $projMetadata['url'] == "https://$project.org"
151 151
                     || $projMetadata['url'] == "https://www.$project") {
152
-                    $this->log->debug(__METHOD__ . " Using cached data for $project");
152
+                    $this->log->debug(__METHOD__." Using cached data for $project");
153 153
                     return $projMetadata;
154 154
                 }
155 155
             }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $optedIn = $this->container->getParameter('opted_in');
293 293
         // In case there's just one given.
294 294
         if (!is_array($optedIn)) {
295
-            $optedIn = [ $optedIn ];
295
+            $optedIn = [$optedIn];
296 296
         }
297 297
         return $optedIn;
298 298
     }
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -339,9 +339,9 @@
 block discarded – undo
339 339
         $conn = $this->getProjectsConnection();
340 340
         $pageTable = $this->getTableName($project->getDatabaseName(), 'page');
341 341
         $query = "SELECT page_id "
342
-             . " FROM $pageTable "
343
-             . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 "
344
-             . " LIMIT 1";
342
+                . " FROM $pageTable "
343
+                . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 "
344
+                . " LIMIT 1";
345 345
         $params = [
346 346
             'ns' => $namespaceId,
347 347
             'title' => str_replace(' ', '_', $pageTitle),
Please login to merge, or discard this patch.
src/Xtools/Edit.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $this->page = $page;
50 50
 
51 51
         // Copy over supported attributes
52
-        $this->id = (int) $attrs['id'];
52
+        $this->id = (int)$attrs['id'];
53 53
 
54 54
         // Allow DateTime or string (latter assumed to be of format YmdHis)
55 55
         if ($attrs['timestamp'] instanceof DateTime) {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $isSection = preg_match_all("/^\/\* (.*?) \*\//", $summary, $sectionMatch);
212 212
 
213 213
         if ($isSection) {
214
-            $pageUrl = $this->getProject()->getUrl(false) . str_replace(
214
+            $pageUrl = $this->getProject()->getUrl(false).str_replace(
215 215
                 '$1',
216 216
                 $this->getPage()->getTitle($useUnnormalizedPageTitle),
217 217
                 $this->getProject()->getArticlePath()
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
             // Must have underscores for the link to properly go to the section
222 222
             $sectionTitleLink = htmlspecialchars(str_replace(' ', '_', $sectionTitle));
223 223
 
224
-            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</a>" .
225
-                "<em class='text-muted'>" . htmlspecialchars($sectionTitle) . ":</em> ";
224
+            $sectionWikitext = "<a target='_blank' href='$pageUrl#$sectionTitleLink'>&rarr;</a>".
225
+                "<em class='text-muted'>".htmlspecialchars($sectionTitle).":</em> ";
226 226
             $summary = str_replace($sectionMatch[0][0], $sectionWikitext, $summary);
227 227
         }
228 228
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             );
237 237
 
238 238
             // Use normalized page title (underscored, capitalized)
239
-            $pageUrl = $this->getProject()->getUrl(false) . str_replace(
239
+            $pageUrl = $this->getProject()->getUrl(false).str_replace(
240 240
                 '$1',
241 241
                 ucfirst(str_replace(' ', '_', $wikiLinkPath)),
242 242
                 $this->getProject()->getArticlePath()
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
     public function getDiffUrl()
275 275
     {
276 276
         $project = $this->getProject();
277
-        $path = str_replace('$1', 'Special:Diff/' . $this->id, $project->getArticlePath());
278
-        return rtrim($project->getUrl(), '/') . $path;
277
+        $path = str_replace('$1', 'Special:Diff/'.$this->id, $project->getArticlePath());
278
+        return rtrim($project->getUrl(), '/').$path;
279 279
     }
280 280
 
281 281
     /**
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
     public function getPermaUrl()
286 286
     {
287 287
         $project = $this->getProject();
288
-        $path = str_replace('$1', 'Special:PermaLink/' . $this->id, $project->getArticlePath());
289
-        return rtrim($project->getUrl(), '/') . $path;
288
+        $path = str_replace('$1', 'Special:PermaLink/'.$this->id, $project->getArticlePath());
289
+        return rtrim($project->getUrl(), '/').$path;
290 290
     }
291 291
 
292 292
     /**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     public function isAutomated(Container $container)
320 320
     {
321
-        return (bool) $this->getTool($container);
321
+        return (bool)$this->getTool($container);
322 322
     }
323 323
 
324 324
     /**
Please login to merge, or discard this patch.