Completed
Push — master ( 765575...5c8b1a )
by MusikAnimal
02:22
created
src/AppBundle/Twig/AppExtension.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -33,33 +33,33 @@  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('xtApiUrl', [ $this, 'xtApiUrl' ]),
55
-            new \Twig_SimpleFunction('isSingleWiki', [ $this, 'isSingleWiki' ]),
56
-            new \Twig_SimpleFunction('getReplagThreshold', [ $this, 'getReplagThreshold' ]),
57
-            new \Twig_SimpleFunction('loadStylesheetsFromCDN', [ $this, 'loadStylesheetsFromCDN' ]),
58
-            new \Twig_SimpleFunction('isWMFLabs', [ $this, 'isWMFLabs' ]),
59
-            new \Twig_SimpleFunction('replag', [ $this, 'replag' ]),
60
-            new \Twig_SimpleFunction('link', [ $this, 'link' ]),
61
-            new \Twig_SimpleFunction('quote', [ $this, 'quote' ]),
62
-            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('xtApiUrl', [$this, 'xtApiUrl']),
55
+            new \Twig_SimpleFunction('isSingleWiki', [$this, 'isSingleWiki']),
56
+            new \Twig_SimpleFunction('getReplagThreshold', [$this, 'getReplagThreshold']),
57
+            new \Twig_SimpleFunction('loadStylesheetsFromCDN', [$this, 'loadStylesheetsFromCDN']),
58
+            new \Twig_SimpleFunction('isWMFLabs', [$this, 'isWMFLabs']),
59
+            new \Twig_SimpleFunction('replag', [$this, 'replag']),
60
+            new \Twig_SimpleFunction('link', [$this, 'link']),
61
+            new \Twig_SimpleFunction('quote', [$this, 'quote']),
62
+            new \Twig_SimpleFunction('bugReportURL', [$this, 'bugReportURL']),
63 63
             new \Twig_SimpleFunction('logged_in_user', [$this, 'functionLoggedInUser']),
64 64
             new \Twig_SimpleFunction('isUserAnon', [$this, 'isUserAnon']),
65 65
             new \Twig_SimpleFunction('nsName', [$this, 'nsName']),
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function requestTime($decimals = 3)
76 76
     {
77
-        return number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], $decimals);
77
+        return number_format(microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'], $decimals);
78 78
     }
79 79
 
80 80
     /**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function intuitionMessageExists($message = "")
109 109
     {
110
-        return $this->getIntuition()->msgExists($message, [ "domain" => "xtools" ]);
110
+        return $this->getIntuition()->msgExists($message, ["domain" => "xtools"]);
111 111
     }
112 112
 
113 113
     /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function intuitionMessage($message = "", $vars = [])
140 140
     {
141
-        return $this->getIntuition()->msg($message, [ "domain" => "xtools", "variables" => $vars ]);
141
+        return $this->getIntuition()->msg($message, ["domain" => "xtools", "variables" => $vars]);
142 142
     }
143 143
 
144 144
     /**
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function getAllLangs()
169 169
     {
170
-        $messageFiles = glob($this->container->getParameter("kernel.root_dir") . '/../i18n/*.json');
170
+        $messageFiles = glob($this->container->getParameter("kernel.root_dir").'/../i18n/*.json');
171 171
 
172 172
         $languages = array_values(array_unique(array_map(
173
-            function ($filename) {
173
+            function($filename) {
174 174
                 return basename($filename, '.json');
175 175
             },
176 176
             $messageFiles
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     public function xtApiUrl()
448 448
     {
449 449
         if ($this->container->hasParameter('app.multithread.enable') &&
450
-            (bool) $this->container->getParameter('app.multithread.enable')
450
+            (bool)$this->container->getParameter('app.multithread.enable')
451 451
         ) {
452 452
             return $this->container->getParameter('app.multithread.api_url');
453 453
         } else {
@@ -534,9 +534,9 @@  discard block
 block discarded – undo
534 534
     public function getFilters()
535 535
     {
536 536
         return [
537
-            new \Twig_SimpleFilter('capitalize_first', [ $this, 'capitalizeFirst' ]),
538
-            new \Twig_SimpleFilter('percent_format', [ $this, 'percentFormat' ]),
539
-            new \Twig_SimpleFilter('diff_format', [ $this, 'diffFormat' ], [ 'is_safe' => [ 'html' ] ]),
537
+            new \Twig_SimpleFilter('capitalize_first', [$this, 'capitalizeFirst']),
538
+            new \Twig_SimpleFilter('percent_format', [$this, 'percentFormat']),
539
+            new \Twig_SimpleFilter('diff_format', [$this, 'diffFormat'], ['is_safe' => ['html']]),
540 540
         ];
541 541
     }
542 542
 
@@ -563,10 +563,10 @@  discard block
 block discarded – undo
563 563
         if (!$denominator) {
564 564
             $quotient = $numerator;
565 565
         } else {
566
-            $quotient = ( $numerator / $denominator ) * 100;
566
+            $quotient = ($numerator / $denominator) * 100;
567 567
         }
568 568
 
569
-        return round($quotient, $precision) . '%';
569
+        return round($quotient, $precision).'%';
570 570
     }
571 571
 
572 572
     /**
@@ -641,20 +641,20 @@  discard block
 block discarded – undo
641 641
 
642 642
         if ($seconds >= 86400) {
643 643
             // Over a day
644
-            $val = (int) floor($seconds / 86400);
644
+            $val = (int)floor($seconds / 86400);
645 645
             $key = 'days';
646 646
         } elseif ($seconds >= 3600) {
647 647
             // Over an hour, less than a day
648
-            $val = (int) floor($seconds / 3600);
648
+            $val = (int)floor($seconds / 3600);
649 649
             $key = 'hours';
650 650
         } elseif ($seconds >= 60) {
651 651
             // Over a minute, less than an hour
652
-            $val = (int) floor($seconds / 60);
652
+            $val = (int)floor($seconds / 60);
653 653
             $key = 'minutes';
654 654
         }
655 655
 
656 656
         if ($translate) {
657
-            return number_format($val) . ' ' . $this->intuitionMessage("num-$key", [$val]);
657
+            return number_format($val).' '.$this->intuitionMessage("num-$key", [$val]);
658 658
         } else {
659 659
             return [number_format($val), "num-$key"];
660 660
         }
Please login to merge, or discard this patch.