Passed
Push — master ( eaf67c...b24cdf )
by Sebastian
04:59
created
src/Localization/Writer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     
69 69
     public function addHashes(array $hashes) : Localization_Writer
70 70
     {
71
-        foreach($hashes as $hash => $text)
71
+        foreach ($hashes as $hash => $text)
72 72
         {
73 73
             $this->addHash($hash, $text);
74 74
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $hashes = $this->compileHashes();
91 91
         $lines = array();
92 92
         
93
-        foreach($hashes as $entry)
93
+        foreach ($hashes as $entry)
94 94
         {
95 95
             $lines[] = sprintf(
96 96
                 '%s= "%s"',
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
     
107 107
     private function renderHead() : string
108 108
     {
109
-        $title = strtoupper($this->fileType).' TRANSLATION FILE FOR ' . strtoupper($this->locale->getLabel());
109
+        $title = strtoupper($this->fileType).' TRANSLATION FILE FOR '.strtoupper($this->locale->getLabel());
110 110
         
111 111
         $lines = array();
112 112
         
113 113
         $lines[] = '; -------------------------------------------------------';
114
-        $lines[] = '; '. $title;
114
+        $lines[] = '; '.$title;
115 115
         $lines[] = '; -------------------------------------------------------';
116 116
         $lines[] = '; ';
117 117
         
118
-        if($this->editable) 
118
+        if ($this->editable) 
119 119
         {
120 120
             $lines[] = '; You may edit text directly in this file under the following conditions:';
121 121
             $lines[] = '; ';
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $hashes = array();
139 139
         
140
-        foreach($this->hashes as $hash => $text)
140
+        foreach ($this->hashes as $hash => $text)
141 141
         {
142 142
             $hashes[] = array(
143 143
                 'hash' => $hash,
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $result = strnatcasecmp($a['text'], $b['text']);
166 166
         
167
-        if($result === 0) 
167
+        if ($result === 0) 
168 168
         {
169 169
             return strnatcmp($a['hash'], $b['hash']);
170 170
         }
Please login to merge, or discard this patch.
src/Localization/Translator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     
58 58
     public function addSources($sources)
59 59
     {
60
-        foreach($sources as $source) {
60
+        foreach ($sources as $source) {
61 61
             $this->addSource($source);
62 62
         }
63 63
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $this->strings[$localeName] = array();
109 109
         }
110 110
 
111
-        foreach($this->sources as $source)
111
+        foreach ($this->sources as $source)
112 112
         {
113 113
             $file = $this->resolveStorageFile($locale, $source);
114 114
             if (!file_exists($file)) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             
118 118
             $data = parse_ini_file($file, false);
119 119
             
120
-            if($data === false) 
120
+            if ($data === false) 
121 121
             {
122 122
                 throw new Localization_Exception(
123 123
                     'Malformatted localization file',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         
190 190
         $name = $locale->getName();
191 191
         
192
-        if(isset($this->strings[$name])) {
192
+        if (isset($this->strings[$name])) {
193 193
             return $this->strings[$name];
194 194
         }
195 195
         
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
     * @param boolean $editable
220 220
     * @throws Localization_Exception
221 221
     */
222
-    protected function renderStringsFile($type, Localization_Source $source, $hashes, $file, Localization_Locale $locale, $editable=true)
222
+    protected function renderStringsFile($type, Localization_Source $source, $hashes, $file, Localization_Locale $locale, $editable = true)
223 223
     {
224 224
         $writer = new Localization_Writer($locale, $type, $file);
225 225
 
226
-        if($editable)
226
+        if ($editable)
227 227
         {
228 228
             $writer->makeEditable();
229 229
         }
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
         
233 233
         foreach ($hashes as $hash) 
234 234
         {
235
-            if(!$hash->hasSourceID($sourceID)) {
235
+            if (!$hash->hasSourceID($sourceID)) {
236 236
                 continue;
237 237
             }
238 238
             
239 239
             $text = $this->getHashTranslation($hash->getHash(), $locale);
240 240
 
241 241
             // skip any empty strings
242
-            if($text === null || trim($text) == '') {
242
+            if ($text === null || trim($text) == '') {
243 243
                 continue;
244 244
             }
245 245
             
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         
318 318
         // to avoid re-creating the hash for the same texts over and over,
319 319
         // we keep track of the hashes we created, and re-use them.
320
-        if(isset($this->reverseStrings[$text])) {
320
+        if (isset($this->reverseStrings[$text])) {
321 321
             $hash = $this->reverseStrings[$text];
322 322
         } else {
323 323
             $hash = md5($text);
@@ -378,15 +378,15 @@  discard block
 block discarded – undo
378 378
      * @param string $hash
379 379
      * @return string|NULL
380 380
      */
381
-    public function getHashTranslation($hash, Localization_Locale $locale=null)
381
+    public function getHashTranslation($hash, Localization_Locale $locale = null)
382 382
     {
383
-        if(!$locale) {
383
+        if (!$locale) {
384 384
             $locale = $this->targetLocale;
385 385
         }
386 386
         
387 387
         $localeName = $locale->getName();
388 388
         
389
-        if(isset($this->strings[$localeName]) && isset($this->strings[$localeName][$hash])) {
389
+        if (isset($this->strings[$localeName]) && isset($this->strings[$localeName][$hash])) {
390 390
             return $this->strings[$localeName][$hash];
391 391
         }
392 392
 
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
     {
404 404
         $result = array();
405 405
         
406
-        foreach($this->sources as $source) 
406
+        foreach ($this->sources as $source) 
407 407
         {
408 408
             $localeFile = self::getClientStorageFile($locale, $source);
409
-            if(!file_exists($localeFile)) {
409
+            if (!file_exists($localeFile)) {
410 410
                 continue;
411 411
             }
412 412
             
Please login to merge, or discard this patch.