Completed
Pull Request — master (#146)
by MusikAnimal
19:38 queued 05:37
created
src/AppBundle/Twig/AppExtension.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -44,32 +44,32 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $options = ['is_safe' => ['html']];
46 46
         return [
47
-            new \Twig_SimpleFunction('request_time', [ $this, 'requestTime' ], $options),
48
-            new \Twig_SimpleFunction('memory_usage', [ $this, 'requestMemory' ], $options),
49
-            new \Twig_SimpleFunction('year', [ $this, 'generateYear' ], $options),
50
-            new \Twig_SimpleFunction('msgPrintExists', [ $this, 'intuitionMessagePrintExists' ], $options),
51
-            new \Twig_SimpleFunction('msgExists', [ $this, 'intuitionMessageExists' ], $options),
52
-            new \Twig_SimpleFunction('msg', [ $this, 'intuitionMessage' ], $options),
53
-            new \Twig_SimpleFunction('lang', [ $this, 'getLang' ], $options),
54
-            new \Twig_SimpleFunction('langName', [ $this, 'getLangName' ], $options),
55
-            new \Twig_SimpleFunction('allLangs', [ $this, 'getAllLangs' ]),
56
-            new \Twig_SimpleFunction('isRTL', [ $this, 'intuitionIsRTL' ]),
57
-            new \Twig_SimpleFunction('isRTLLang', [ $this, 'intuitionIsRTLLang' ]),
58
-            new \Twig_SimpleFunction('shortHash', [ $this, 'gitShortHash' ]),
59
-            new \Twig_SimpleFunction('hash', [ $this, 'gitHash' ]),
60
-            new \Twig_SimpleFunction('releaseDate', [ $this, 'gitDate' ]),
61
-            new \Twig_SimpleFunction('enabled', [ $this, 'tabEnabled' ]),
62
-            new \Twig_SimpleFunction('tools', [ $this, 'allTools' ]),
63
-            new \Twig_SimpleFunction('color', [ $this, 'getColorList' ]),
64
-            new \Twig_SimpleFunction('chartColor', [ $this, 'chartColor' ]),
65
-            new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]),
66
-            new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]),
67
-            new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]),
68
-            new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]),
69
-            new \Twig_SimpleFunction('replag', [ $this, 'replag' ]),
70
-            new \Twig_SimpleFunction('link', [ $this, 'link' ]),
71
-            new \Twig_SimpleFunction('quote', [ $this, 'quote' ]),
72
-            new \Twig_SimpleFunction('bugReportURL', [ $this, 'bugReportURL' ]),
47
+            new \Twig_SimpleFunction('request_time', [$this, 'requestTime'], $options),
48
+            new \Twig_SimpleFunction('memory_usage', [$this, 'requestMemory'], $options),
49
+            new \Twig_SimpleFunction('year', [$this, 'generateYear'], $options),
50
+            new \Twig_SimpleFunction('msgPrintExists', [$this, 'intuitionMessagePrintExists'], $options),
51
+            new \Twig_SimpleFunction('msgExists', [$this, 'intuitionMessageExists'], $options),
52
+            new \Twig_SimpleFunction('msg', [$this, 'intuitionMessage'], $options),
53
+            new \Twig_SimpleFunction('lang', [$this, 'getLang'], $options),
54
+            new \Twig_SimpleFunction('langName', [$this, 'getLangName'], $options),
55
+            new \Twig_SimpleFunction('allLangs', [$this, 'getAllLangs']),
56
+            new \Twig_SimpleFunction('isRTL', [$this, 'intuitionIsRTL']),
57
+            new \Twig_SimpleFunction('isRTLLang', [$this, 'intuitionIsRTLLang']),
58
+            new \Twig_SimpleFunction('shortHash', [$this, 'gitShortHash']),
59
+            new \Twig_SimpleFunction('hash', [$this, 'gitHash']),
60
+            new \Twig_SimpleFunction('releaseDate', [$this, 'gitDate']),
61
+            new \Twig_SimpleFunction('enabled', [$this, 'tabEnabled']),
62
+            new \Twig_SimpleFunction('tools', [$this, 'allTools']),
63
+            new \Twig_SimpleFunction('color', [$this, 'getColorList']),
64
+            new \Twig_SimpleFunction('chartColor', [$this, 'chartColor']),
65
+            new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']),
66
+            new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']),
67
+            new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']),
68
+            new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']),
69
+            new \Twig_SimpleFunction('replag', [$this, 'replag']),
70
+            new \Twig_SimpleFunction('link', [$this, 'link']),
71
+            new \Twig_SimpleFunction('quote', [$this, 'quote']),
72
+            new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']),
73 73
             new \Twig_SimpleFunction('logged_in_user', [$this, 'functionLoggedInUser']),
74 74
             new \Twig_SimpleFunction('isUserAnon', [$this, 'isUserAnon']),
75 75
             new \Twig_SimpleFunction('nsName', [$this, 'nsName']),
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     public function requestTime()
88 88
     {
89 89
         if (!isset($this->requestTime)) {
90
-            $this->requestTime = microtime(true) - $this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT');
90
+            $this->requestTime = microtime(true)-$this->getCurrentRequest()->server->get('REQUEST_TIME_FLOAT');
91 91
         }
92 92
 
93 93
         return $this->requestTime;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function intuitionMessage($message = "", $vars = [])
162 162
     {
163
-        return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]);
163
+        return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]);
164 164
     }
165 165
 
166 166
     /**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function getAllLangs()
191 191
     {
192
-        $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json');
192
+        $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json');
193 193
 
194 194
         $languages = array_values(array_unique(array_map(
195
-            function ($filename) {
195
+            function($filename) {
196 196
                 return basename($filename, '.json');
197 197
             },
198 198
             $messageFiles
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
     public function getFilters()
541 541
     {
542 542
         return [
543
-            new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]),
544
-            new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]),
545
-            new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]),
543
+            new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']),
544
+            new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']),
545
+            new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]),
546 546
             new \Twig_SimpleFilter('num_format', [$this, 'numberFormat']),
547 547
             new \Twig_SimpleFilter('date_format', [$this, 'dateFormatStd']),
548 548
             new \Twig_SimpleFilter('date_localize', [$this, 'dateFormat']),
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
         if (!$denominator) {
632 632
             $quotient = $numerator;
633 633
         } else {
634
-            $quotient = ( $numerator / $denominator ) * 100;
634
+            $quotient = ($numerator / $denominator) * 100;
635 635
         }
636 636
 
637
-        return $this->numberFormat($quotient, $precision) . '%';
637
+        return $this->numberFormat($quotient, $precision).'%';
638 638
     }
639 639
 
640 640
     /**
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         list($val, $key) = $this->getDurationMessageKey($seconds);
705 705
 
706 706
         if ($translate) {
707
-            return $this->numberFormat($val) . ' ' . $this->intuitionMessage("num-$key", [$val]);
707
+            return $this->numberFormat($val).' '.$this->intuitionMessage("num-$key", [$val]);
708 708
         } else {
709 709
             return [$this->numberFormat($val), "num-$key"];
710 710
         }
@@ -725,15 +725,15 @@  discard block
 block discarded – undo
725 725
 
726 726
         if ($seconds >= 86400) {
727 727
             // Over a day
728
-            $val = (int) floor($seconds / 86400);
728
+            $val = (int)floor($seconds / 86400);
729 729
             $key = 'days';
730 730
         } elseif ($seconds >= 3600) {
731 731
             // Over an hour, less than a day
732
-            $val = (int) floor($seconds / 3600);
732
+            $val = (int)floor($seconds / 3600);
733 733
             $key = 'hours';
734 734
         } elseif ($seconds >= 60) {
735 735
             // Over a minute, less than an hour
736
-            $val = (int) floor($seconds / 60);
736
+            $val = (int)floor($seconds / 60);
737 737
             $key = 'minutes';
738 738
         }
739 739
 
Please login to merge, or discard this patch.