Passed
Push — main ( e456c4...a9dbf5 )
by Thierry
03:02
created
src/Translation/Translator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function setLocale(string $sLocale)
49 49
     {
50
-        if(($sLocale = trim($sLocale)))
50
+        if (($sLocale = trim($sLocale)))
51 51
         {
52 52
             $this->sDefaultLocale = $sLocale;
53 53
         }
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
      */
65 65
     private function _loadTranslations(string $sLanguage, string $sPrefix, array $aTranslations)
66 66
     {
67
-        foreach($aTranslations as $sKey => $xTranslation)
67
+        foreach ($aTranslations as $sKey => $xTranslation)
68 68
         {
69 69
             $sKey = trim($sKey);
70 70
             $sKey = ($sPrefix) ? $sPrefix . '.' . $sKey : $sKey;
71
-            if(is_array($xTranslation))
71
+            if (is_array($xTranslation))
72 72
             {
73 73
                 // Recursively read the translations in the array
74 74
                 $this->_loadTranslations($sLanguage, $sKey, $xTranslation);
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function loadTranslations(string $sFilePath, string $sLanguage)
93 93
     {
94
-        if(!file_exists($sFilePath))
94
+        if (!file_exists($sFilePath))
95 95
         {
96 96
             return;
97 97
         }
98 98
         $aTranslations = require($sFilePath);
99
-        if(!is_array($aTranslations))
99
+        if (!is_array($aTranslations))
100 100
         {
101 101
             return;
102 102
         }
103 103
         // Load the translations
104
-        if(!isset($this->aTranslations[$sLanguage]))
104
+        if (!isset($this->aTranslations[$sLanguage]))
105 105
         {
106 106
             $this->aTranslations[$sLanguage] = [];
107 107
         }
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
     public function trans(string $sText, array $aPlaceHolders = [], string $sLanguage = ''): string
121 121
     {
122 122
         $sText = trim($sText);
123
-        if(empty($sLanguage))
123
+        if (empty($sLanguage))
124 124
         {
125 125
             $sLanguage = $this->sDefaultLocale;
126 126
         }
127
-        if(!isset($this->aTranslations[$sLanguage][$sText]))
127
+        if (!isset($this->aTranslations[$sLanguage][$sText]))
128 128
         {
129 129
             return $sText;
130 130
         }
131 131
         $sMessage = $this->aTranslations[$sLanguage][$sText];
132
-        if(!empty($aPlaceHolders))
132
+        if (!empty($aPlaceHolders))
133 133
         {
134 134
             $aVars = array_map(function($sVar) {
135 135
                 return ':' . $sVar;
Please login to merge, or discard this patch.