Test Setup Failed
Push — master ( c19eb6...053651 )
by Fran
03:12
created
src/base/types/helpers/I18nHelper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $locale = Request::header('X-API-LANG');
29 29
         if (empty($locale)) {
30 30
             $locale = Security::getInstance()->getSessionKey(self::PSFS_SESSION_LANGUAGE_KEY);
31
-            if(empty($locale)) {
31
+            if (empty($locale)) {
32 32
                 $BrowserLocales = explode(",", str_replace("-", "_", $_SERVER["HTTP_ACCEPT_LANGUAGE"])); // brosers use en-US, Linux uses en_US
33 33
                 for ($i = 0; $i < count($BrowserLocales); $i++) {
34 34
                     list($BrowserLocales[$i]) = explode(";", $BrowserLocales[$i]); //trick for "en;q=0.8"
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
         if (false !== strpos($locale, '_')) {
41 41
             $locale = explode('_', $locale);
42 42
             if ($locale[0] == 'en') {
43
-                $locale = $locale[0] . '_GB';
44
-            } else {
45
-                $locale = $locale[0] . '_' . strtoupper($locale[1]);
43
+                $locale = $locale[0].'_GB';
44
+            }else {
45
+                $locale = $locale[0].'_'.strtoupper($locale[1]);
46 46
             }
47
-        } else {
47
+        }else {
48 48
             if (strtolower($locale) === 'en') {
49 49
                 $locale = 'en_GB';
50
-            } else {
51
-                $locale = $locale . '_' . strtoupper($locale);
50
+            }else {
51
+                $locale = $locale.'_'.strtoupper($locale);
52 52
             }
53 53
         }
54 54
         if (!in_array($locale, self::$langs)) {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $translations = array();
70 70
         if (file_exists($absoluteTranslationFileName)) {
71 71
             @include($absoluteTranslationFileName);
72
-        } else {
72
+        }else {
73 73
             Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
74 74
         }
75 75
 
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
     public static function setLocale()
83 83
     {
84 84
         $locale = self::extractLocale('es_ES');
85
-        Logger::log('Set locale to project [' . $locale . ']');
85
+        Logger::log('Set locale to project ['.$locale.']');
86 86
         // Load translations
87
-        putenv("LC_ALL=" . $locale);
87
+        putenv("LC_ALL=".$locale);
88 88
         setlocale(LC_ALL, $locale);
89 89
         // Load the locale path
90
-        $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale';
91
-        Logger::log('Set locale dir ' . $locale_path);
90
+        $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale';
91
+        Logger::log('Set locale dir '.$locale_path);
92 92
         GeneratorHelper::createDir($locale_path);
93 93
         bindtextdomain('translations', $locale_path);
94 94
         textdomain('translations');
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public static function checkI18Class($namespace) {
125 125
         $isI18n = false;
126
-        if(preg_match('/I18n$/i', $namespace)) {
126
+        if (preg_match('/I18n$/i', $namespace)) {
127 127
             $parentClass = preg_replace('/I18n$/i', '', $namespace);
128
-            if(Router::exists($parentClass)) {
128
+            if (Router::exists($parentClass)) {
129 129
                 $isI18n = true;
130 130
             }
131 131
         }
Please login to merge, or discard this patch.