Completed
Pull Request — master (#137)
by MusikAnimal
04:23
created
src/Xtools/AutoEdits.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function countAutomatedEdits()
44 44
     {
45
-        return (int) $this->getRepository()->countAutomatedEdits(
45
+        return (int)$this->getRepository()->countAutomatedEdits(
46 46
             $this->project,
47 47
             $this->user,
48 48
             $this->namespace,
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 
71 71
         $namespaces = $this->project->getNamespaces();
72 72
 
73
-        return array_map(function ($rev) use ($namespaces) {
73
+        return array_map(function($rev) use ($namespaces) {
74 74
             $pageTitle = $rev['page_title'];
75 75
             $fullPageTitle = '';
76 76
 
77 77
             if ($rev['page_namespace'] !== '0') {
78
-                $fullPageTitle = $namespaces[$rev['page_namespace']] . ":$pageTitle";
78
+                $fullPageTitle = $namespaces[$rev['page_namespace']].":$pageTitle";
79 79
             } else {
80 80
                 $fullPageTitle = $pageTitle;
81 81
             }
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
             return [
84 84
                 'full_page_title' => $fullPageTitle,
85 85
                 'page_title' => $pageTitle,
86
-                'page_namespace' => (int) $rev['page_namespace'],
87
-                'rev_id' => (int) $rev['rev_id'],
86
+                'page_namespace' => (int)$rev['page_namespace'],
87
+                'rev_id' => (int)$rev['rev_id'],
88 88
                 'timestamp' => DateTime::createFromFormat('YmdHis', $rev['timestamp']),
89
-                'minor' => (bool) $rev['minor'],
90
-                'length' => (int) $rev['length'],
91
-                'length_change' => (int) $rev['length_change'],
89
+                'minor' => (bool)$rev['minor'],
90
+                'length' => (int)$rev['length'],
91
+                'length_change' => (int)$rev['length_change'],
92 92
                 'comment' => $rev['comment'],
93 93
             ];
94 94
         }, $revs);
Please login to merge, or discard this patch.
src/Xtools/UserRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -250,8 +250,8 @@
 block discarded – undo
250 250
                 FROM $pageTable
251 251
                 JOIN $revisionTable ON page_id = rev_page
252 252
                 $paJoin
253
-                WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition" .
254
-                ($hasPageAssessments ? 'GROUP BY rev_page' : '') . "
253
+                WHERE $whereRev AND rev_parent_id = '0' $namespaceConditionRev $redirectCondition".
254
+                ($hasPageAssessments ? 'GROUP BY rev_page' : '')."
255 255
             )
256 256
 
257 257
             UNION
Please login to merge, or discard this patch.
src/Xtools/AutoEditsRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $tagJoin = $tags != '' ? "LEFT OUTER JOIN $tagTable ON ct_rev_id = rev_id" : '';
52 52
             $condTools[] = "ct_tag IN ($tags)";
53 53
         }
54
-        $condTool = 'AND (' . implode(' OR ', $condTools) . ')';
54
+        $condTool = 'AND ('.implode(' OR ', $condTools).')';
55 55
 
56 56
         $sql = "SELECT COUNT(DISTINCT(rev_id))
57 57
                 FROM $revisionTable
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 $condEnd";
65 65
 
66 66
         $resultQuery = $this->executeQuery($sql, $user, $namespace, $start, $end);
67
-        $result = (int) $resultQuery->fetchColumn();
67
+        $result = (int)$resultQuery->fetchColumn();
68 68
 
69 69
         // Cache for 10 minutes, and return.
70 70
         $this->setCache($cacheKey, $result);
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
         }
194 194
 
195 195
         // Sort the array by count
196
-        uasort($results, function ($a, $b) {
197
-            return $b['count'] - $a['count'];
196
+        uasort($results, function($a, $b) {
197
+            return $b['count']-$a['count'];
198 198
         });
199 199
 
200 200
         // Cache for 10 minutes, and return.
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
             // Developer error, no regex or tag provided for this tool.
240 240
             if ($condTool === '') {
241
-                throw new Exception("No regex or tag found for the tool $toolname. " .
241
+                throw new Exception("No regex or tag found for the tool $toolname. ".
242 242
                     "Please verify this entry in semi_automated.yml");
243 243
             }
244 244
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             if ($condTool === '') {
285 285
                 $condTool = "ct_tag = $tag";
286 286
             } else {
287
-                $condTool = '(' . $condTool . " OR ct_tag = $tag)";
287
+                $condTool = '('.$condTool." OR ct_tag = $tag)";
288 288
             }
289 289
         }
290 290
 
Please login to merge, or discard this patch.
src/Xtools/User.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             return $this->editCounts[$domain];
94 94
         }
95 95
 
96
-        $this->editCounts[$domain] = (int) $this->getRepository()->getEditCount(
96
+        $this->editCounts[$domain] = (int)$this->getRepository()->getEditCount(
97 97
             $project->getDatabaseName(),
98 98
             $this->getUsername()
99 99
         );
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function isAnon()
161 161
     {
162
-        return (bool) filter_var($this->username, FILTER_VALIDATE_IP);
162
+        return (bool)filter_var($this->username, FILTER_VALIDATE_IP);
163 163
     }
164 164
 
165 165
     /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     public function countEdits(Project $project, $namespace = 'all', $start = '', $end = '')
223 223
     {
224
-        return (int) $this->getRepository()->countEdits($project, $this, $namespace, $start, $end);
224
+        return (int)$this->getRepository()->countEdits($project, $this, $namespace, $start, $end);
225 225
     }
226 226
 
227 227
     /**
Please login to merge, or discard this patch.
src/AppBundle/Controller/AutomatedEditsController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
         // Get individual counts of how many times each tool was used.
127 127
         // This also includes a wikilink to the tool.
128 128
         $toolCounts = $autoEdits->getAutomatedCounts();
129
-        $toolsTotal = array_reduce($toolCounts, function ($a, $b) {
130
-            return $a + $b['count'];
129
+        $toolsTotal = array_reduce($toolCounts, function($a, $b) {
130
+            return $a+$b['count'];
131 131
         });
132 132
 
133 133
         // Query to get combined (semi)automated using for all edits
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             $res['automated_editcount'] = $autoEdits->countAutomatedEdits();
204 204
         }
205 205
 
206
-        $res['nonautomated_editcount'] = $res['total_editcount'] - $res['automated_editcount'];
206
+        $res['nonautomated_editcount'] = $res['total_editcount']-$res['automated_editcount'];
207 207
 
208 208
         $response->setData($res);
209 209
         return $response;
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
             if ($request->query->get('format') !== 'html') {
244 244
                 return new JsonResponse(
245 245
                     [
246
-                        'error' => 'Unable to show any data. User has made over ' .
247
-                            $user->maxEdits() . ' edits.',
246
+                        'error' => 'Unable to show any data. User has made over '.
247
+                            $user->maxEdits().' edits.',
248 248
                     ],
249 249
                     Response::HTTP_FORBIDDEN
250 250
                 );
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
         if ($request->query->get('format') === 'html') {
264 264
             if ($edits) {
265
-                $edits = array_map(function ($attrs) use ($project, $user) {
265
+                $edits = array_map(function($attrs) use ($project, $user) {
266 266
                     $page = $project->getRepository()
267 267
                         ->getPage($project, $attrs['full_page_title']);
268 268
                     $pageTitles[] = $attrs['full_page_title'];
Please login to merge, or discard this patch.