Cancelled
Pull Request — master (#149)
by Albert
05:31
created
src/Xtools/Repository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         // $tableExtension in order to generate the new table name
195 195
         if ($this->isLabs() && $tableExtension !== null) {
196 196
             $mapped = true;
197
-            $tableName = $tableName . '_' . $tableExtension;
197
+            $tableName = $tableName.'_'.$tableExtension;
198 198
         } elseif ($this->container->hasParameter("app.table.$tableName")) {
199 199
             // Use the table specified in the table mapping configuration, if present.
200 200
             $mapped = true;
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
         $datesConditions = '';
304 304
         if (false !== $start) {
305 305
             // Convert to YYYYMMDDHHMMSS. *who in the world thought of having time in BLOB of this format ;-;*
306
-            $start = date('Ymd', $start) . '000000';
306
+            $start = date('Ymd', $start).'000000';
307 307
             $datesConditions .= " AND {$tableAlias}{$field} > '$start'";
308 308
         }
309 309
         if (false !== $end) {
310
-            $end = date('Ymd', $end) . '000000';
310
+            $end = date('Ymd', $end).'000000';
311 311
             $datesConditions .= " AND {$tableAlias}{$field} < '$end'";
312 312
         }
313 313
 
Please login to merge, or discard this patch.
src/Xtools/ArticleInfo.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     public function getMaxRevisions()
194 194
     {
195 195
         if (!isset($this->maxRevisions)) {
196
-            $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions');
196
+            $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions');
197 197
         }
198 198
         return $this->maxRevisions;
199 199
     }
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
         $this->yearMonthCounts[$editYear]['all']++;
927 927
         $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']++;
928 928
         // This will ultimately be the size of the page by the end of the year
929
-        $this->yearMonthCounts[$editYear]['size'] = (int) $edit->getLength();
929
+        $this->yearMonthCounts[$editYear]['size'] = (int)$edit->getLength();
930 930
 
931 931
         // Keep track of which month had the most edits
932 932
         $editsThisMonth = $this->yearMonthCounts[$editYear]['months'][$editMonth]['all'];
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
         $editYear = $edit->getYear();
946 946
 
947 947
         // Beginning of the month at 00:00:00.
948
-        $firstEditTime = mktime(0, 0, 0, (int) $this->firstEdit->getMonth(), 1, $this->firstEdit->getYear());
948
+        $firstEditTime = mktime(0, 0, 0, (int)$this->firstEdit->getMonth(), 1, $this->firstEdit->getYear());
949 949
 
950 950
         $this->yearMonthCounts[$editYear] = [
951 951
             'all' => 0,
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
         for ($i = 1; $i <= 12; $i++) {
961 961
             $timeObj = mktime(0, 0, 0, $i, 1, $editYear);
962 962
 
963
-            $date = $editYear . sprintf('%02d', $i) . '01';
963
+            $date = $editYear.sprintf('%02d', $i).'01';
964 964
             if (false !== $this->startDate && $date < date('Ymd', $this->startDate)
965 965
                 || false !== $this->endDate && $date > date('Ymd', $this->endDate)) {
966 966
                 continue;
@@ -1086,14 +1086,14 @@  discard block
 block discarded – undo
1086 1086
         $botData = $this->getRepository()->getBotData($this->page, $this->startDate, $this->endDate);
1087 1087
         while ($bot = $botData->fetch()) {
1088 1088
             $bots[$bot['username']] = [
1089
-                'count' => (int) $bot['count'],
1089
+                'count' => (int)$bot['count'],
1090 1090
                 'current' => $bot['current'] === 'bot',
1091 1091
             ];
1092 1092
         }
1093 1093
 
1094 1094
         // Sort by edit count.
1095
-        uasort($bots, function ($a, $b) {
1096
-            return $b['count'] - $a['count'];
1095
+        uasort($bots, function($a, $b) {
1096
+            return $b['count']-$a['count'];
1097 1097
         });
1098 1098
 
1099 1099
         $this->bots = $bots;
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
             if ($info['all'] > 1) {
1210 1210
                 // Number of seconds/days between first and last edit.
1211
-                $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp();
1211
+                $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp();
1212 1212
                 $days = $secs / (60 * 60 * 24);
1213 1213
 
1214 1214
                 // Average time between edits (in days).
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
         // First sort editors array by the amount of text they added.
1229 1229
         $topTenEditorsByAdded = $this->editors;
1230
-        uasort($topTenEditorsByAdded, function ($a, $b) {
1230
+        uasort($topTenEditorsByAdded, function($a, $b) {
1231 1231
             if ($a['added'] === $b['added']) {
1232 1232
                 return 0;
1233 1233
             }
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
         // Then build a new array of top 10 editors by added text,
1238 1238
         // in the data structure needed for the chart.
1239
-        $this->topTenEditorsByAdded = array_map(function ($editor) {
1239
+        $this->topTenEditorsByAdded = array_map(function($editor) {
1240 1240
             $added = $this->editors[$editor]['added'];
1241 1241
             return [
1242 1242
                 'label' => $editor,
Please login to merge, or discard this patch.
src/Xtools/Page.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $info = $this->getPageInfo();
93 93
         $title = isset($info['title']) ? $info['title'] : $this->unnormalizedPageName;
94 94
         $nsName = $this->getNamespaceName();
95
-        return str_replace($nsName . ':', '', $title);
95
+        return str_replace($nsName.':', '', $title);
96 96
     }
97 97
 
98 98
     /**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     {
231 231
         // If a user is given, we will not cache the result via instance variable.
232 232
         if ($user !== null) {
233
-            return (int) $this->getRepository()->getNumRevisions($this, $user, $start, $end);
233
+            return (int)$this->getRepository()->getNumRevisions($this, $user, $start, $end);
234 234
         }
235 235
 
236 236
         // Return cached value, if present.
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             $this->numRevisions = count($this->revisions);
244 244
         } else {
245 245
             // Otherwise do a COUNT in the event fetching all revisions is not desired.
246
-            $this->numRevisions = (int) $this->getRepository()->getNumRevisions($this, null, $start, $end);
246
+            $this->numRevisions = (int)$this->getRepository()->getNumRevisions($this, null, $start, $end);
247 247
         }
248 248
 
249 249
         return $this->numRevisions;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $content = $this->getRepository()->getPagesWikitext(
277 277
             $this->getProject(),
278
-            [ $this->getTitle() ]
278
+            [$this->getTitle()]
279 279
         );
280 280
 
281 281
         return isset($content[$this->getTitle()])
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
         $wikidataInfo = $this->getRepository()->getWikidataInfo($this);
442 442
 
443
-        $terms = array_map(function ($entry) {
443
+        $terms = array_map(function($entry) {
444 444
             return $entry['term'];
445 445
         }, $wikidataInfo);
446 446
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
                 'prio' => 2,
452 452
                 'name' => 'Wikidata',
453 453
                 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n
454
-                'explanation' => "See: <a target='_blank' " .
454
+                'explanation' => "See: <a target='_blank' ".
455 455
                     "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>",
456 456
             ];
457 457
         }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                 'prio' => 3,
462 462
                 'name' => 'Wikidata',
463 463
                 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n
464
-                'explanation' => "See: <a target='_blank' " .
464
+                'explanation' => "See: <a target='_blank' ".
465 465
                     "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>",
466 466
             ];
467 467
         }
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
             return 0;
541 541
         }
542 542
 
543
-        return array_sum(array_map(function ($item) {
544
-            return (int) $item['views'];
543
+        return array_sum(array_map(function($item) {
544
+            return (int)$item['views'];
545 545
         }, $pageviews['items']));
546 546
     }
547 547
 
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
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $datesConditions = $this->createDatesConditions($start, $end);
28 28
 
29 29
         $sql = "SELECT COUNT(rev_user_text) AS count, rev_user_text AS username, ug_group AS current
30
-                FROM " . $project->getTableName('revision') . "
30
+                FROM " . $project->getTableName('revision')."
31 31
                 LEFT JOIN $userGroupsTable ON rev_user = ug_user
32 32
                 LEFT JOIN $userFormerGroupsTable ON rev_user = ufg_user
33 33
                 WHERE rev_page = :pageId AND (ug_group = 'bot' OR ufg_group = 'bot') $datesConditions
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
         $sql = "SELECT log_action, log_type, log_timestamp AS 'timestamp'
56 56
                 FROM $loggingTable
57
-                WHERE log_namespace = '" . $page->getNamespace() . "'
57
+                WHERE log_namespace = '".$page->getNamespace()."'
58 58
                 AND log_title = :title AND log_timestamp > 1 $datesConditions
59 59
                 AND log_type IN ('delete', 'move', 'protect', 'stable')";
60 60
         $title = str_replace(' ', '_', $page->getTitle());
Please login to merge, or discard this patch.