Passed
Pull Request — master (#263)
by Ankit
07:52
created
src/AppBundle/Model/CategoryEdits.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the CategoryEdits class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     ) {
47 47
         $this->project = $project;
48 48
         $this->user = $user;
49
-        $this->categories = array_map(function ($category) {
49
+        $this->categories = array_map(function($category) {
50 50
             return str_replace(' ', '_', $category);
51 51
         }, $categories);
52 52
         $this->start = false === $start ? '' : date('Y-m-d', $start);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function getCategoriesNormalized(): array
80 80
     {
81
-        return array_map(function ($category) {
81
+        return array_map(function($category) {
82 82
             return str_replace('_', ' ', $category);
83 83
         }, $this->categories);
84 84
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     private function getEditsFromRevs(array $revs): array
185 185
     {
186
-        return array_map(function ($rev) {
186
+        return array_map(function($rev) {
187 187
             /** @var Page $page Page object to be passed to the Edit constructor. */
188 188
             $page = $this->getPageFromRev($rev);
189 189
             $rev['user'] = $this->user;
Please login to merge, or discard this patch.
src/AppBundle/Model/User.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the User class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             return $this->editCounts[$domain];
124 124
         }
125 125
 
126
-        $this->editCounts[$domain] = (int) $this->getRepository()->getEditCount(
126
+        $this->editCounts[$domain] = (int)$this->getRepository()->getEditCount(
127 127
             $project->getDatabaseName(),
128 128
             $this->getUsername()
129 129
         );
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function isAnon(): bool
169 169
     {
170
-        return (bool) filter_var($this->username, FILTER_VALIDATE_IP);
170
+        return (bool)filter_var($this->username, FILTER_VALIDATE_IP);
171 171
     }
172 172
 
173 173
     /**
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function countEdits(Project $project, $namespace = 'all', $start = '', $end = ''): int
230 230
     {
231
-        return (int) $this->getRepository()->countEdits($project, $this, $namespace, $start, $end);
231
+        return (int)$this->getRepository()->countEdits($project, $this, $namespace, $start, $end);
232 232
     }
233 233
 
234 234
     /**
Please login to merge, or discard this patch.
src/AppBundle/Model/Page.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the Page class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $info = $this->getPageInfo();
94 94
         $title = $info['title'] ?? $this->unnormalizedPageName;
95 95
         $nsName = $this->getNamespaceName();
96
-        return str_replace($nsName . ':', '', $title);
96
+        return str_replace($nsName.':', '', $title);
97 97
     }
98 98
 
99 99
     /**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     {
292 292
         $content = $this->getRepository()->getPagesWikitext(
293 293
             $this->getProject(),
294
-            [ $this->getTitle() ]
294
+            [$this->getTitle()]
295 295
         );
296 296
 
297 297
         return $content[$this->getTitle()] ?? null;
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
         $wikidataInfo = $this->getRepository()->getWikidataInfo($this);
361 361
 
362
-        $terms = array_map(function ($entry) {
362
+        $terms = array_map(function($entry) {
363 363
             return $entry['term'];
364 364
         }, $wikidataInfo);
365 365
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 'prio' => 2,
371 371
                 'name' => 'Wikidata',
372 372
                 'notice' => "Label for language <em>$lang</em> is missing", // FIXME: i18n
373
-                'explanation' => "See: <a target='_blank' " .
373
+                'explanation' => "See: <a target='_blank' ".
374 374
                     "href='//www.wikidata.org/wiki/Help:Label'>Help:Label</a>",
375 375
             ];
376 376
         }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                 'prio' => 3,
381 381
                 'name' => 'Wikidata',
382 382
                 'notice' => "Description for language <em>$lang</em> is missing", // FIXME: i18n
383
-                'explanation' => "See: <a target='_blank' " .
383
+                'explanation' => "See: <a target='_blank' ".
384 384
                     "href='//www.wikidata.org/wiki/Help:Description'>Help:Description</a>",
385 385
             ];
386 386
         }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
             return 0;
459 459
         }
460 460
 
461
-        return array_sum(array_map(function ($item) {
461
+        return array_sum(array_map(function($item) {
462 462
             return (int)$item['views'];
463 463
         }, $pageviews['items']));
464 464
     }
Please login to merge, or discard this patch.
src/AppBundle/Model/SimpleEditCounter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the SimpleEditCounter class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function getTotalEditCount(): int
122 122
     {
123
-        return $this->data['deletedEditCount'] + $this->data['liveEditCount'];
123
+        return $this->data['deletedEditCount']+$this->data['liveEditCount'];
124 124
     }
125 125
 
126 126
     /**
Please login to merge, or discard this patch.
src/AppBundle/Model/Model.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
  * This file contains only the Model class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
Please login to merge, or discard this patch.
src/AppBundle/Model/ArticleInfo.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the ArticleInfo class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     public function getMaxRevisions(): int
244 244
     {
245 245
         if (!isset($this->maxRevisions)) {
246
-            $this->maxRevisions = (int) $this->container->getParameter('app.max_page_revisions');
246
+            $this->maxRevisions = (int)$this->container->getParameter('app.max_page_revisions');
247 247
         }
248 248
         return $this->maxRevisions;
249 249
     }
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
         $this->yearMonthCounts[$editYear]['all']++;
1013 1013
         $this->yearMonthCounts[$editYear]['months'][$editMonth]['all']++;
1014 1014
         // This will ultimately be the size of the page by the end of the year
1015
-        $this->yearMonthCounts[$editYear]['size'] = (int) $edit->getLength();
1015
+        $this->yearMonthCounts[$editYear]['size'] = (int)$edit->getLength();
1016 1016
 
1017 1017
         // Keep track of which month had the most edits
1018 1018
         $editsThisMonth = $this->yearMonthCounts[$editYear]['months'][$editMonth]['all'];
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
         }
1168 1168
 
1169 1169
         // Sort by edit count.
1170
-        uasort($bots, function ($a, $b) {
1171
-            return $b['count'] - $a['count'];
1170
+        uasort($bots, function($a, $b) {
1171
+            return $b['count']-$a['count'];
1172 1172
         });
1173 1173
 
1174 1174
         $this->bots = $bots;
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 
1278 1278
             if ($info['all'] > 1) {
1279 1279
                 // Number of seconds/days between first and last edit.
1280
-                $secs = $info['last']->getTimestamp() - $info['first']->getTimestamp();
1280
+                $secs = $info['last']->getTimestamp()-$info['first']->getTimestamp();
1281 1281
                 $days = $secs / (60 * 60 * 24);
1282 1282
 
1283 1283
                 // Average time between edits (in days).
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
         }
1287 1287
 
1288 1288
         // Loop through again and add percentages.
1289
-        $this->topTenEditorsByEdits = array_map(function ($editor) use ($topTenCount) {
1289
+        $this->topTenEditorsByEdits = array_map(function($editor) use ($topTenCount) {
1290 1290
             $editor['percentage'] = 100 * ($editor['value'] / $topTenCount);
1291 1291
             return $editor;
1292 1292
         }, $topTenEditorsByEdits);
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
     {
1305 1305
         // First sort editors array by the amount of text they added.
1306 1306
         $topTenEditorsByAdded = $this->editors;
1307
-        uasort($topTenEditorsByAdded, function ($a, $b) {
1307
+        uasort($topTenEditorsByAdded, function($a, $b) {
1308 1308
             if ($a['added'] === $b['added']) {
1309 1309
                 return 0;
1310 1310
             }
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
         // }, $topTenEditorsByAdded));
1321 1321
 
1322 1322
         // Then build a new array of top 10 editors by added text in the data structure needed for the chart.
1323
-        return array_map(function ($editor) {
1323
+        return array_map(function($editor) {
1324 1324
             $added = $this->editors[$editor]['added'];
1325 1325
             return [
1326 1326
                 'label' => $editor,
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
 
1471 1471
         $refs = $crawler->filter('#mw-content-text .reference');
1472 1472
         $refContent = [];
1473
-        $refs->each(function ($ref) use (&$refContent): void {
1473
+        $refs->each(function($ref) use (&$refContent): void {
1474 1474
             $refContent[] = $ref->text();
1475 1475
         });
1476 1476
         $uniqueRefs = count(array_unique($refContent));
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
         $totalChars = 0;
1498 1498
         $totalWords = 0;
1499 1499
         $paragraphs = $crawler->filter($selector);
1500
-        $paragraphs->each(function ($node) use (&$totalChars, &$totalWords): void {
1500
+        $paragraphs->each(function($node) use (&$totalChars, &$totalWords): void {
1501 1501
             $text = preg_replace('/\[\d+\]/', '', trim($node->text()));
1502 1502
             $totalChars += strlen($text);
1503 1503
             $totalWords += count(explode(' ', $text));
Please login to merge, or discard this patch.
src/AppBundle/Model/Project.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the Project class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function getUrl(bool $withTrailingSlash = true): string
147 147
     {
148
-        return rtrim($this->getBasicInfo()['url'], '/') . ($withTrailingSlash ? '/' : '');
148
+        return rtrim($this->getBasicInfo()['url'], '/').($withTrailingSlash ? '/' : '');
149 149
     }
150 150
 
151 151
     /**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     public function getScript(): string
191 191
     {
192 192
         $metadata = $this->getMetadata();
193
-        return $metadata['general']['script'] ?? $this->getScriptPath() . '/index.php';
193
+        return $metadata['general']['script'] ?? $this->getScriptPath().'/index.php';
194 194
     }
195 195
 
196 196
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function getApiUrl(): string
201 201
     {
202
-        return rtrim($this->getUrl(), '/') . $this->getRepository()->getApiPath();
202
+        return rtrim($this->getUrl(), '/').$this->getRepository()->getApiPath();
203 203
     }
204 204
 
205 205
     /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function userOptInPage(User $user): string
260 260
     {
261
-        $localPageName = 'User:' . $user->getUsername() . '/EditCounterOptIn.js';
261
+        $localPageName = 'User:'.$user->getUsername().'/EditCounterOptIn.js';
262 262
         return $localPageName;
263 263
     }
264 264
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         }
294 294
 
295 295
         // 4. Lastly, see if they've opted in globally on the default project or Meta.
296
-        $globalPageName = $user->getUsername() . '/EditCounterGlobalOptIn.js';
296
+        $globalPageName = $user->getUsername().'/EditCounterGlobalOptIn.js';
297 297
         $globalProject = $this->getRepository()->getGlobalProject();
298 298
         if ($globalProject instanceof Project) {
299 299
             $globalExists = $globalProject->getRepository()
Please login to merge, or discard this patch.
src/AppBundle/Model/RFX.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * An RFX object contains the parsed information for an RFX
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             }
107 107
         }
108 108
 
109
-        $final = [];    // initialize the final array
109
+        $final = []; // initialize the final array
110 110
         $finalRaw = []; // Initialize the raw data array
111 111
 
112 112
         foreach (array_keys($this->data) as $key) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         $final = array_count_values($final); // find repetition and its count
121 121
 
122
-        $final = array_diff($final, [1]);    // remove single occurrences
122
+        $final = array_diff($final, [1]); // remove single occurrences
123 123
 
124 124
         $this->duplicates = array_keys($final);
125 125
     }
Please login to merge, or discard this patch.
src/AppBundle/Model/UserRights.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
  * This file contains only the UserRights class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
Please login to merge, or discard this patch.