Passed
Push — master ( 46c6bf...6db2a9 )
by MusikAnimal
05:41
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/Xtools/RFX.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             }
120 120
         }
121 121
 
122
-        $final = [];    // initialize the final array
122
+        $final = []; // initialize the final array
123 123
         $finalRaw = []; // Initialize the raw data array
124 124
 
125 125
         foreach ($this->data as $key => $value) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         $final = array_count_values($final); // find repetition and its count
134 134
 
135
-        $final = array_diff($final, [1]);    // remove single occurrences
135
+        $final = array_diff($final, [1]); // remove single occurrences
136 136
 
137 137
         $this->duplicates = array_keys($final);
138 138
     }
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
@@ -330,9 +330,9 @@
 block discarded – undo
330 330
     {
331 331
         $pageTable = $this->getTableName($project->getDatabaseName(), 'page');
332 332
         $query = "SELECT page_id "
333
-             . " FROM $pageTable "
334
-             . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 "
335
-             . " LIMIT 1";
333
+                . " FROM $pageTable "
334
+                . " WHERE page_namespace = :ns AND page_title = :title AND page_len > 0 "
335
+                . " LIMIT 1";
336 336
         $params = [
337 337
             'ns' => $namespaceId,
338 338
             'title' => str_replace(' ', '_', $pageTitle),
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
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     public function loginAction()
90 90
     {
91 91
         try {
92
-            list( $next, $token ) = $this->getOauthClient()->initiate();
92
+            list($next, $token) = $this->getOauthClient()->initiate();
93 93
         } catch (Exception $oauthException) {
94 94
             throw $oauthException;
95 95
             // @TODO Make this work.
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                     . '?title=Special:OAuth';
157 157
         $conf = new ClientConfig($endpoint);
158 158
         $consumerKey = $this->getParameter('oauth_key');
159
-        $consumerSecret =  $this->getParameter('oauth_secret');
159
+        $consumerSecret = $this->getParameter('oauth_secret');
160 160
         $conf->setConsumer(new Consumer($consumerKey, $consumerSecret));
161 161
         $this->oauthClient = new Client($conf);
162 162
         // Callback URL is hardcoded in the consumer registration.
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/Xtools/SimpleEditCounter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
      */
162 162
     public function getTotalEditCount()
163 163
     {
164
-        return $this->data['deletedEditCount'] + $this->data['liveEditCount'];
164
+        return $this->data['deletedEditCount']+$this->data['liveEditCount'];
165 165
     }
166 166
 
167 167
     /**
Please login to merge, or discard this patch.
src/AppBundle/Controller/MetaController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $timeline = [];
96 96
         $startObj = new DateTime($start);
97 97
         $endObj = new DateTime($end);
98
-        $numDays = (int) $endObj->diff($startObj)->format("%a");
98
+        $numDays = (int)$endObj->diff($startObj)->format("%a");
99 99
         $grandSum = 0;
100 100
 
101 101
         // Generate array of date labels
@@ -105,17 +105,17 @@  discard block
 block discarded – undo
105 105
 
106 106
         foreach ($data as $entry) {
107 107
             if (!isset($totals[$entry['tool']])) {
108
-                $totals[$entry['tool']] = (int) $entry['count'];
108
+                $totals[$entry['tool']] = (int)$entry['count'];
109 109
 
110 110
                 // Create arrays for each tool, filled with zeros for each date in the timeline
111 111
                 $timeline[$entry['tool']] = array_fill(0, $numDays, 0);
112 112
             } else {
113
-                $totals[$entry['tool']] += (int) $entry['count'];
113
+                $totals[$entry['tool']] += (int)$entry['count'];
114 114
             }
115 115
 
116 116
             $date = new DateTime($entry['date']);
117
-            $dateIndex = (int) $date->diff($startObj)->format("%a");
118
-            $timeline[$entry['tool']][$dateIndex] = (int) $entry['count'];
117
+            $dateIndex = (int)$date->diff($startObj)->format("%a");
118
+            $timeline[$entry['tool']][$dateIndex] = (int)$entry['count'];
119 119
 
120 120
             $grandSum += $entry['count'];
121 121
         }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $timeline = [];
153 153
         $startObj = new DateTime($start);
154 154
         $endObj = new DateTime($end);
155
-        $numDays = (int) $endObj->diff($startObj)->format("%a");
155
+        $numDays = (int)$endObj->diff($startObj)->format("%a");
156 156
         $grandSum = 0;
157 157
 
158 158
         // Generate array of date labels
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 
163 163
         foreach ($data as $entry) {
164 164
             if (!isset($totals[$entry['endpoint']])) {
165
-                $totals[$entry['endpoint']] = (int) $entry['count'];
165
+                $totals[$entry['endpoint']] = (int)$entry['count'];
166 166
 
167 167
                 // Create arrays for each endpoint, filled with zeros for each date in the timeline
168 168
                 $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0);
169 169
             } else {
170
-                $totals[$entry['endpoint']] += (int) $entry['count'];
170
+                $totals[$entry['endpoint']] += (int)$entry['count'];
171 171
             }
172 172
 
173 173
             $date = new DateTime($entry['date']);
174
-            $dateIndex = (int) $date->diff($startObj)->format("%a");
175
-            $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count'];
174
+            $dateIndex = (int)$date->diff($startObj)->format("%a");
175
+            $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count'];
176 176
 
177 177
             $grandSum += $entry['count'];
178 178
         }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         }
220 220
 
221 221
         $conn = $this->container->get('doctrine')->getManager('default')->getConnection();
222
-        $date =  date('Y-m-d');
222
+        $date = date('Y-m-d');
223 223
 
224 224
         // Increment count in timeline
225 225
         $existsSql = "SELECT 1 FROM usage_timeline
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/TopEditsRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments() && $namespace === 0;
48 48
         $paTable = $this->getTableName($project->getDatabaseName(), 'page_assessments');
49 49
         $paSelect = $hasPageAssessments
50
-            ?  ", (
50
+            ? ", (
51 51
                     SELECT pa_class
52 52
                     FROM $paTable
53 53
                     WHERE pa_page_id = page_id
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $hasPageAssessments = $this->isLabs() && $project->hasPageAssessments();
99 99
         $pageAssessmentsTable = $this->getTableName($project->getDatabaseName(), 'page_assessments');
100 100
         $paSelect = $hasPageAssessments
101
-            ?  ", (
101
+            ? ", (
102 102
                     SELECT pa_class
103 103
                     FROM $pageAssessmentsTable
104 104
                     WHERE pa_page_id = e.page_id
Please login to merge, or discard this patch.