| @@ -34,7 +34,7 @@ | ||
| 34 | 34 | public function __construct(TemplateEngine $engine, array $aVars) | 
| 35 | 35 |      { | 
| 36 | 36 | $this->__engine__ = $engine; | 
| 37 | - foreach($aVars as $sName => $xValue) | |
| 37 | + foreach ($aVars as $sName => $xValue) | |
| 38 | 38 |          { | 
| 39 | 39 | $sName = (string)$sName; | 
| 40 | 40 | $this->$sName = $xValue; | 
| @@ -45,7 +45,7 @@ discard block | ||
| 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 | ||
| 62 | 62 | */ | 
| 63 | 63 | private function _loadTranslations(string $sLanguage, string $sPrefix, array $aTranslations) | 
| 64 | 64 |      { | 
| 65 | - foreach($aTranslations as $sKey => $xTranslation) | |
| 65 | + foreach ($aTranslations as $sKey => $xTranslation) | |
| 66 | 66 |          { | 
| 67 | 67 | $sKey = trim($sKey); | 
| 68 | 68 | $sKey = ($sPrefix) ? $sPrefix . '.' . $sKey : $sKey; | 
| 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, $sKey, $xTranslation); | 
| @@ -89,17 +89,17 @@ discard block | ||
| 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 | ||
| 118 | 118 | public function trans(string $sText, array $aPlaceHolders = [], string $sLanguage = ''): string | 
| 119 | 119 |      { | 
| 120 | 120 | $sText = trim($sText); | 
| 121 | - if(empty($sLanguage)) | |
| 121 | + if (empty($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(!empty($aPlaceHolders)) | |
| 130 | + if (!empty($aPlaceHolders)) | |
| 131 | 131 |          { | 
| 132 | 132 |              $aVars = array_map(function($sVar) { | 
| 133 | 133 | return ':' . $sVar; | 
| @@ -70,8 +70,7 @@ | ||
| 70 | 70 |              { | 
| 71 | 71 | // Recursively read the translations in the array | 
| 72 | 72 | $this->_loadTranslations($sLanguage, $sKey, $xTranslation); | 
| 73 | - } | |
| 74 | - else | |
| 73 | + } else | |
| 75 | 74 |              { | 
| 76 | 75 | // Save this translation | 
| 77 | 76 | $this->aTranslations[$sLanguage][$sKey] = $xTranslation; |