Completed
Push — master ( 213592...bdf5df )
by Matthew
13:39 queued 01:37
created
src/Xtools/PagesRepository.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * Get metadata about a single page from the API.
20 20
      * @param Project $project The project to which the page belongs.
21 21
      * @param string $pageTitle Page title.
22
-     * @return string[] Array with some of the following keys: pageid, title, missing, displaytitle,
22
+     * @return string|null Array with some of the following keys: pageid, title, missing, displaytitle,
23 23
      * url.
24 24
      */
25 25
     public function getPageInfo(Project $project, $pageTitle)
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      * @param int $numRevisions Number of revisions, if known. This is used solely to determine the
136 136
      *   OFFSET if we are given a $limit (see below). If $limit is set and $numRevisions is not set,
137 137
      *   a separate query is ran to get the nuber of revisions.
138
-     * @return Doctrine\DBAL\Driver\PDOStatement
138
+     * @return \Doctrine\DBAL\Driver\Statement
139 139
      */
140 140
     public function getRevisionsStmt(Page $page, User $user = null, $limit = null, $numRevisions = null)
141 141
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 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
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 
379 379
         $wikidataId = ltrim($page->getWikidataId(), 'Q');
380 380
 
381
-        $sql = "SELECT " . ($count ? 'COUNT(*) AS count' : '*') . "
381
+        $sql = "SELECT ".($count ? 'COUNT(*) AS count' : '*')."
382 382
                 FROM wikidatawiki_p.wb_items_per_site
383 383
                 WHERE ips_item_id = :wikidataId";
384 384
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
         $result = $resultQuery->fetchAll();
390 390
 
391
-        return $count ? (int) $result[0]['count'] : $result;
391
+        return $count ? (int)$result[0]['count'] : $result;
392 392
     }
393 393
 
394 394
     /**
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
         // Transform to associative array by 'type'
430 430
         foreach ($res as $row) {
431
-            $data[$row['type'] . '_count'] = $row['value'];
431
+            $data[$row['type'].'_count'] = $row['value'];
432 432
         }
433 433
 
434 434
         return $data;
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
         $project = $page->getProject()->getDomain();
468 468
 
469
-        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' .
469
+        $url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/'.
470 470
             "$project/all-access/user/$title/daily/$start/$end";
471 471
 
472 472
         $res = $client->request('GET', $url);
Please login to merge, or discard this patch.
src/AppBundle/Controller/ArticleInfoController.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
         $article = $request->query->get('article');
82 82
 
83 83
         if ($projectQuery != '' && $article != '') {
84
-            return $this->redirectToRoute('ArticleInfoResult', [ 'project'=>$projectQuery, 'article' => $article ]);
84
+            return $this->redirectToRoute('ArticleInfoResult', ['project'=>$projectQuery, 'article' => $article]);
85 85
         } elseif ($article != '') {
86
-            return $this->redirectToRoute('ArticleInfoProject', [ 'project'=>$projectQuery ]);
86
+            return $this->redirectToRoute('ArticleInfoProject', ['project'=>$projectQuery]);
87 87
         }
88 88
 
89 89
         if ($projectQuery == '') {
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
             $rendered = str_replace('"', '\"', trim($rendered));
122 122
 
123 123
             // Uglify temporary file.
124
-            $tmpFile = sys_get_temp_dir() . '/xtools_articleinfo_gadget.js';
124
+            $tmpFile = sys_get_temp_dir().'/xtools_articleinfo_gadget.js';
125 125
             $script = "echo \"$rendered\" | tee $tmpFile >/dev/null && ";
126
-            $script .= $this->get('kernel')->getRootDir() .
127
-                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle " .
126
+            $script .= $this->get('kernel')->getRootDir().
127
+                "/Resources/node_modules/uglify-es/bin/uglifyjs $tmpFile --mangle ".
128 128
                 "&& rm $tmpFile >/dev/null";
129 129
             $process = new Process($script);
130 130
             $process->run();
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
             $rendered = str_replace('\"', '"', trim($rendered));
144 144
 
145 145
             // Add comment after uglifying since it removes comments.
146
-            $rendered = "/**\n * This code was automatically generated and should not " .
147
-                "be manually edited.\n * For updates, please copy and paste from " .
148
-                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL) .
149
-                "\n * Released under GPL v3 license.\n */\n" . $rendered;
146
+            $rendered = "/**\n * This code was automatically generated and should not ".
147
+                "be manually edited.\n * For updates, please copy and paste from ".
148
+                $this->generateUrl('ArticleInfoGadget', ['uglify' => 1], UrlGeneratorInterface::ABSOLUTE_URL).
149
+                "\n * Released under GPL v3 license.\n */\n".$rendered;
150 150
         }
151 151
 
152 152
         $response = new \Symfony\Component\HttpFoundation\Response($rendered);
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9 9
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10 10
 use Symfony\Component\HttpFoundation\Request;
11
-use Symfony\Component\DependencyInjection\ContainerInterface;
12 11
 use Symfony\Component\HttpFoundation\Response;
13 12
 use Symfony\Component\Process\Process;
14 13
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Please login to merge, or discard this patch.
src/AppBundle/Twig/AppExtension.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,32 +33,32 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $options = ['is_safe' => ['html']];
35 35
         return [
36
-            new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options),
37
-            new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options),
38
-            new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options),
39
-            new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options),
40
-            new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options),
41
-            new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options),
42
-            new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options),
43
-            new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options),
44
-            new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]),
45
-            new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]),
46
-            new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]),
47
-            new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]),
48
-            new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]),
49
-            new \Twig_SimpleFunction('releaseDate', [ $this, 'gitDate' ]),
50
-            new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]),
51
-            new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]),
52
-            new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]),
53
-            new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]),
54
-            new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]),
55
-            new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]),
56
-            new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]),
57
-            new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]),
58
-            new \Twig_SimpleFunction('replag', [ $this, 'replag' ]),
59
-            new \Twig_SimpleFunction('link', [ $this, 'link' ]),
60
-            new \Twig_SimpleFunction('quote', [ $this, 'quote' ]),
61
-            new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]),
36
+            new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options),
37
+            new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options),
38
+            new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options),
39
+            new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options),
40
+            new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options),
41
+            new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options),
42
+            new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options),
43
+            new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options),
44
+            new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']),
45
+            new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']),
46
+            new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']),
47
+            new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']),
48
+            new \Twig_SimpleFunction('hash', [$this, 'gitHash']),
49
+            new \Twig_SimpleFunction('releaseDate', [$this, 'gitDate']),
50
+            new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']),
51
+            new \Twig_SimpleFunction('tools', [$this, 'allTools']),
52
+            new \Twig_SimpleFunction('color', [$this, 'getColorList']),
53
+            new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']),
54
+            new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']),
55
+            new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']),
56
+            new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']),
57
+            new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']),
58
+            new \Twig_SimpleFunction('replag', [$this, 'replag']),
59
+            new \Twig_SimpleFunction('link', [$this, 'link']),
60
+            new \Twig_SimpleFunction('quote', [$this, 'quote']),
61
+            new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']),
62 62
             new \Twig_SimpleFunction('logged_in_user', [$this, 'functionLoggedInUser']),
63 63
             new \Twig_SimpleFunction('isUserAnon', [$this, 'isUserAnon']),
64 64
             new \Twig_SimpleFunction('nsName', [$this, 'nsName']),
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function requestTime($decimals = 3)
75 75
     {
76
-        return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals);
76
+        return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals);
77 77
     }
78 78
 
79 79
     /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function intuitionMessage($message = "", $vars = [])
147 147
     {
148
-        return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]);
148
+        return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]);
149 149
     }
150 150
 
151 151
     /**
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function getAllLangs()
176 176
     {
177
-        $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json');
177
+        $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json');
178 178
 
179 179
         $languages = array_values(array_unique(array_map(
180
-            function ($filename) {
180
+            function($filename) {
181 181
                 return basename($filename, '.json');
182 182
             },
183 183
             $messageFiles
@@ -524,9 +524,9 @@  discard block
 block discarded – undo
524 524
     public function getFilters()
525 525
     {
526 526
         return [
527
-            new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]),
528
-            new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]),
529
-            new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]),
527
+            new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']),
528
+            new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']),
529
+            new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]),
530 530
         ];
531 531
     }
532 532
 
@@ -553,10 +553,10 @@  discard block
 block discarded – undo
553 553
         if (!$denominator) {
554 554
             $quotient = $numerator;
555 555
         } else {
556
-            $quotient = ( $numerator / $denominator ) * 100;
556
+            $quotient = ($numerator / $denominator) * 100;
557 557
         }
558 558
 
559
-        return round($quotient, $precision) . '%';
559
+        return round($quotient, $precision).'%';
560 560
     }
561 561
 
562 562
     /**
@@ -631,20 +631,20 @@  discard block
 block discarded – undo
631 631
 
632 632
         if ($seconds >= 86400) {
633 633
             // Over a day
634
-            $val = (int) floor($seconds / 86400);
634
+            $val = (int)floor($seconds / 86400);
635 635
             $key = 'days';
636 636
         } elseif ($seconds >= 3600) {
637 637
             // Over an hour, less than a day
638
-            $val = (int) floor($seconds / 3600);
638
+            $val = (int)floor($seconds / 3600);
639 639
             $key = 'hours';
640 640
         } elseif ($seconds >= 60) {
641 641
             // Over a minute, less than an hour
642
-            $val = (int) floor($seconds / 60);
642
+            $val = (int)floor($seconds / 60);
643 643
             $key = 'minutes';
644 644
         }
645 645
 
646 646
         if ($translate) {
647
-            return number_format($val) . ' ' . $this->intuitionMessage("num-$key", [$val]);
647
+            return number_format($val).' '.$this->intuitionMessage("num-$key", [$val]);
648 648
         } else {
649 649
             return [number_format($val), "num-$key"];
650 650
         }
Please login to merge, or discard this patch.