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