Passed
Push — master ( 52b2ea...eaf67c )
by Sebastian
08:23
created
localization/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     $autoload = realpath($root.'/../vendor/autoload.php');
14 14
     
15 15
     // we need the autoloader to be present
16
-    if(!file_exists($autoload)) {
16
+    if (!file_exists($autoload)) {
17 17
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
18 18
     }
19 19
     
Please login to merge, or discard this patch.
example/index.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
17 17
     }
18 18
 
19
-   /**
20
-    * The composer autoloader
21
-    */
19
+    /**
20
+     * The composer autoloader
21
+     */
22 22
     require_once $autoload;
23 23
 
24 24
     // the folder in which the localization .ini files are stored
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     $autoload = realpath($root.'/../vendor/autoload.php');
14 14
     
15 15
     // we need the autoloader to be present
16
-    if(!file_exists($autoload)) {
16
+    if (!file_exists($autoload)) {
17 17
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
18 18
     }
19 19
     
Please login to merge, or discard this patch.
example/sources/php/sources3.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
     $text = t('This text is in the global scope.');
4 4
     
5 5
     $text2 = t(
6
-        'It is possible to write long texts ' .
7
-        'using text concatenation in the source ' .
6
+        'It is possible to write long texts '.
7
+        'using text concatenation in the source '.
8 8
         'code to keep it readable.'
9 9
     );
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
src/Localization/Translator.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     
46 46
     private $targetLocaleName = null;
47 47
     
48
-   /**
49
-    * @var Localization_Source[]
50
-    */
48
+    /**
49
+     * @var Localization_Source[]
50
+     */
51 51
     private $sources = array();
52 52
 
53 53
     public function addSource(Localization_Source $source)
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
         );
175 175
     }
176 176
     
177
-   /**
178
-    * Retrieves all available strings for the specified locale,
179
-    * as hash => text value pairs.
180
-    * 
181
-    * @param Localization_Locale $locale
182
-    * @throws Localization_Exception
183
-    * @return string[]
184
-    */
177
+    /**
178
+     * Retrieves all available strings for the specified locale,
179
+     * as hash => text value pairs.
180
+     * 
181
+     * @param Localization_Locale $locale
182
+     * @throws Localization_Exception
183
+     * @return string[]
184
+     */
185 185
     public function getStrings(Localization_Locale $locale)
186 186
     {
187 187
         $this->load($locale);
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
         return !empty($this->strings[$locale->getName()]);
211 211
     }
212 212
     
213
-   /**
214
-    * @param string $type
215
-    * @param Localization_Scanner_StringHash[] $hashes
216
-    * @param string $file
217
-    * @param Localization_Locale $locale
218
-    * @param boolean $editable
219
-    * @throws Localization_Exception
220
-    */
213
+    /**
214
+     * @param string $type
215
+     * @param Localization_Scanner_StringHash[] $hashes
216
+     * @param string $file
217
+     * @param Localization_Locale $locale
218
+     * @param boolean $editable
219
+     * @throws Localization_Exception
220
+     */
221 221
     protected function renderStringsFile($type, Localization_Source $source, $hashes, $file, Localization_Locale $locale, $editable=true)
222 222
     {
223 223
         $sourceID = $source->getID();
@@ -280,16 +280,16 @@  discard block
 block discarded – undo
280 280
         }
281 281
     }
282 282
     
283
-   /**
284
-    * Sort the strings to ensure they always appear in the same order:
285
-    * first by text, and same strings by their hashes. This is important 
286
-    * for strings that have the same translation to avoid them changing 
287
-    * order between sorts.
288
-    * 
289
-    * @param array $a
290
-    * @param array $b
291
-    * @return number
292
-    */
283
+    /**
284
+     * Sort the strings to ensure they always appear in the same order:
285
+     * first by text, and same strings by their hashes. This is important 
286
+     * for strings that have the same translation to avoid them changing 
287
+     * order between sorts.
288
+     * 
289
+     * @param array $a
290
+     * @param array $b
291
+     * @return number
292
+     */
293 293
     public function callback_sortStrings($a, $b)
294 294
     {
295 295
         $result = strnatcasecmp($a['text'], $b['text']);
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
         );
317 317
     }
318 318
     
319
-   /**
320
-    * Retrieves the full path to the strings storage ini file 
321
-    * for the clientside strings.
322
-    * 
323
-    * @param Localization_Locale $locale
324
-    * @return string
325
-    */
319
+    /**
320
+     * Retrieves the full path to the strings storage ini file 
321
+     * for the clientside strings.
322
+     * 
323
+     * @param Localization_Locale $locale
324
+     * @return string
325
+     */
326 326
     protected function getClientStorageFile(Localization_Locale $locale, Localization_Source $source)
327 327
     {
328 328
         return sprintf(
@@ -444,12 +444,12 @@  discard block
 block discarded – undo
444 444
         return null;
445 445
     }
446 446
 
447
-   /**
448
-    * Retrieves only the strings that are available clientside.
449
-    * 
450
-    * @param Localization_Locale $locale
451
-    * @return array
452
-    */
447
+    /**
448
+     * Retrieves only the strings that are available clientside.
449
+     * 
450
+     * @param Localization_Locale $locale
451
+     * @return array
452
+     */
453 453
     public function getClientStrings(Localization_Locale $locale)
454 454
     {
455 455
         $result = array();
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 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,25 +219,25 @@  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
         $sourceID = $source->getID();
225 225
         
226
-        $title = strtoupper($type).' TRANSLATION FILE FOR ' . strtoupper($locale->getLabel());
226
+        $title = strtoupper($type).' TRANSLATION FILE FOR '.strtoupper($locale->getLabel());
227 227
         
228
-        $content  = '; -------------------------------------------------------' . PHP_EOL;
229
-        $content .= '; '. $title . PHP_EOL;
230
-        $content .= '; -------------------------------------------------------' . PHP_EOL;
231
-        $content .= '; ' . PHP_EOL;
228
+        $content  = '; -------------------------------------------------------'.PHP_EOL;
229
+        $content .= '; '.$title.PHP_EOL;
230
+        $content .= '; -------------------------------------------------------'.PHP_EOL;
231
+        $content .= '; '.PHP_EOL;
232 232
         
233
-        if($editable) {
234
-            $content .= '; You may edit text directly in this file under the following conditions:' . PHP_EOL;
235
-            $content .= '; ' . PHP_EOL;
236
-            $content .= '; 1) Do not to modify the keys (left hand side of the = sign)' . PHP_EOL;
237
-            $content .= '; 2) Save the file as UTF-8 without BOM' . PHP_EOL;
233
+        if ($editable) {
234
+            $content .= '; You may edit text directly in this file under the following conditions:'.PHP_EOL;
235
+            $content .= '; '.PHP_EOL;
236
+            $content .= '; 1) Do not to modify the keys (left hand side of the = sign)'.PHP_EOL;
237
+            $content .= '; 2) Save the file as UTF-8 without BOM'.PHP_EOL;
238 238
         } else {
239
-            $content .= '; Do NOT edit this file directly! It depends on the main translation file' . PHP_EOL;
240
-            $content .= '; and any changes will be lost. Edit the main file instead.' . PHP_EOL;
239
+            $content .= '; Do NOT edit this file directly! It depends on the main translation file'.PHP_EOL;
240
+            $content .= '; and any changes will be lost. Edit the main file instead.'.PHP_EOL;
241 241
         }
242 242
         
243 243
         $content .= PHP_EOL;
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
         $saveList = array();
246 246
         foreach ($hashes as $hash) 
247 247
         {
248
-            if(!$hash->hasSourceID($sourceID)) {
248
+            if (!$hash->hasSourceID($sourceID)) {
249 249
                 continue;
250 250
             }
251 251
             
252 252
             $text = $this->getHashTranslation($hash->getHash(), $locale);
253 253
 
254 254
             // skip any empty strings
255
-            if($text === null || trim($text) == '') {
255
+            if ($text === null || trim($text) == '') {
256 256
                 continue;
257 257
             }
258 258
             
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
         
265 265
         usort($saveList, array($this, 'callback_sortStrings'));
266 266
 
267
-        foreach($saveList as $entry) {
268
-            $content .= $entry['hash'] . '= "' . $entry['text'] . '"' . PHP_EOL;
267
+        foreach ($saveList as $entry) {
268
+            $content .= $entry['hash'].'= "'.$entry['text'].'"'.PHP_EOL;
269 269
         }
270 270
 
271
-        if(!file_put_contents($file, $content)) {
271
+        if (!file_put_contents($file, $content)) {
272 272
             throw new Localization_Exception(
273 273
                 'Cannot save localization file',
274 274
                 sprintf(
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     public function callback_sortStrings($a, $b)
295 295
     {
296 296
         $result = strnatcasecmp($a['text'], $b['text']);
297
-        if($result==0) {
297
+        if ($result == 0) {
298 298
             return strnatcmp($a['hash'], $b['hash']);
299 299
         }
300 300
         
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         
370 370
         // to avoid re-creating the hash for the same texts over and over,
371 371
         // we keep track of the hashes we created, and re-use them.
372
-        if(isset($this->reverseStrings[$text])) {
372
+        if (isset($this->reverseStrings[$text])) {
373 373
             $hash = $this->reverseStrings[$text];
374 374
         } else {
375 375
             $hash = md5($text);
@@ -430,15 +430,15 @@  discard block
 block discarded – undo
430 430
      * @param string $hash
431 431
      * @return string|NULL
432 432
      */
433
-    public function getHashTranslation($hash, Localization_Locale $locale=null)
433
+    public function getHashTranslation($hash, Localization_Locale $locale = null)
434 434
     {
435
-        if(!$locale) {
435
+        if (!$locale) {
436 436
             $locale = $this->targetLocale;
437 437
         }
438 438
         
439 439
         $localeName = $locale->getName();
440 440
         
441
-        if(isset($this->strings[$localeName]) && isset($this->strings[$localeName][$hash])) {
441
+        if (isset($this->strings[$localeName]) && isset($this->strings[$localeName][$hash])) {
442 442
             return $this->strings[$localeName][$hash];
443 443
         }
444 444
 
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
     {
456 456
         $result = array();
457 457
         
458
-        foreach($this->sources as $source) 
458
+        foreach ($this->sources as $source) 
459 459
         {
460 460
             $localeFile = self::getClientStorageFile($locale, $source);
461
-            if(!file_exists($localeFile)) {
461
+            if (!file_exists($localeFile)) {
462 462
                 continue;
463 463
             }
464 464
             
Please login to merge, or discard this patch.
src/Localization/Scanner/StringsCollection.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -10,19 +10,19 @@  discard block
 block discarded – undo
10 10
     
11 11
     const STORAGE_FORMAT_VERSION = 1;
12 12
     
13
-   /**
14
-    * @var Localization_Scanner
15
-    */
13
+    /**
14
+     * @var Localization_Scanner
15
+     */
16 16
     protected $scanner;
17 17
     
18
-   /**
19
-    * @var Localization_Scanner_StringHash[]
20
-    */
18
+    /**
19
+     * @var Localization_Scanner_StringHash[]
20
+     */
21 21
     protected $hashes = array();
22 22
     
23
-   /**
24
-    * @var array
25
-    */
23
+    /**
24
+     * @var array
25
+     */
26 26
     protected $warnings = array();
27 27
     
28 28
     public function __construct(Localization_Scanner $scanner)
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
         return $string;
52 52
     }
53 53
     
54
-   /**
55
-    * Adds a single translateable string.
56
-    * 
57
-    * @param Localization_Scanner_StringInfo $string
58
-    * @return Localization_Scanner_StringsCollection
59
-    */
54
+    /**
55
+     * Adds a single translateable string.
56
+     * 
57
+     * @param Localization_Scanner_StringInfo $string
58
+     * @return Localization_Scanner_StringsCollection
59
+     */
60 60
     protected function add(Localization_Scanner_StringInfo $string)
61 61
     {
62 62
         $hash = $string->getHash();
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
         return $this;
70 70
     }
71 71
     
72
-   /**
73
-    * Retrieves all available translateable strings, 
74
-    * grouped by their hash to identify unique strings.
75
-    * 
76
-    * @return Localization_Scanner_StringHash[]
77
-    */
72
+    /**
73
+     * Retrieves all available translateable strings, 
74
+     * grouped by their hash to identify unique strings.
75
+     * 
76
+     * @return Localization_Scanner_StringHash[]
77
+     */
78 78
     public function getHashes()
79 79
     {
80 80
         return array_values($this->hashes);
@@ -133,32 +133,32 @@  discard block
 block discarded – undo
133 133
         return true;
134 134
     }
135 135
     
136
-   /**
137
-    * Whether the parser reported warnings during the
138
-    * search for translateable texts.
139
-    * 
140
-    * @return bool
141
-    */
136
+    /**
137
+     * Whether the parser reported warnings during the
138
+     * search for translateable texts.
139
+     * 
140
+     * @return bool
141
+     */
142 142
     public function hasWarnings() : bool
143 143
     {
144 144
         return !empty($this->warnings);
145 145
     }
146 146
     
147
-   /**
148
-    * Retrieves the amount of warnings.
149
-    * @return int
150
-    */
147
+    /**
148
+     * Retrieves the amount of warnings.
149
+     * @return int
150
+     */
151 151
     public function countWarnings() : int
152 152
     {
153 153
         return count($this->warnings);
154 154
     }
155 155
     
156
-   /**
157
-    * Retrieves all warning messages that were added
158
-    * during the search for translateable texts, if any.
159
-    * 
160
-    * @return Localization_Scanner_StringsCollection_Warning[]
161
-    */
156
+    /**
157
+     * Retrieves all warning messages that were added
158
+     * during the search for translateable texts, if any.
159
+     * 
160
+     * @return Localization_Scanner_StringsCollection_Warning[]
161
+     */
162 162
     public function getWarnings() : array
163 163
     {
164 164
         $result = array();
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
         return $amount;
186 186
     }
187 187
     
188
-   /**
189
-    * Retrieves all string hashed for the specified source.
190
-    * 
191
-    * @param string $id
192
-    * @return \AppLocalize\Localization_Scanner_StringHash[]
193
-    */
188
+    /**
189
+     * Retrieves all string hashed for the specified source.
190
+     * 
191
+     * @param string $id
192
+     * @return \AppLocalize\Localization_Scanner_StringHash[]
193
+     */
194 194
     public function getHashesBySourceID(string $id) 
195 195
     {
196 196
         $hashes = array();
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
         return $hashes;
205 205
     }
206 206
     
207
-   /**
208
-    * Retrieves all hashes for the specified language ID.
209
-    * 
210
-    * @param string $languageID The language ID, e.g. "PHP"
211
-    * @return \AppLocalize\Localization_Scanner_StringHash[]
212
-    */
207
+    /**
208
+     * Retrieves all hashes for the specified language ID.
209
+     * 
210
+     * @param string $languageID The language ID, e.g. "PHP"
211
+     * @return \AppLocalize\Localization_Scanner_StringHash[]
212
+     */
213 213
     public function getHashesByLanguageID(string $languageID)
214 214
     {
215 215
         $hashes = array();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $hash = $string->getHash();
63 63
         
64
-        if(!isset($this->hashes[$hash])) {
64
+        if (!isset($this->hashes[$hash])) {
65 65
             $this->hashes[$hash] = new Localization_Scanner_StringHash($this, $hash);
66 66
         }
67 67
         
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     
88 88
     public function getHash($hash)
89 89
     {
90
-        if(isset($this->hashes[$hash])) {
90
+        if (isset($this->hashes[$hash])) {
91 91
             return $this->hashes[$hash];
92 92
         }
93 93
         
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             'warnings' => array()
107 107
         );
108 108
         
109
-        foreach($this->hashes as $hash)
109
+        foreach ($this->hashes as $hash)
110 110
         {
111 111
             $data['hashes'] = array_merge($data['hashes'], $hash->toArray());
112 112
         }
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
     
119 119
     public function fromArray($array) : bool
120 120
     {
121
-        if(!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) {
121
+        if (!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) {
122 122
             return false;
123 123
         }
124 124
         
125
-        foreach($array['hashes'] as $entry) 
125
+        foreach ($array['hashes'] as $entry) 
126 126
         {
127 127
             $string = Localization_Scanner_StringInfo::fromArray($this, $entry);
128 128
             $this->add($string);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     {
164 164
         $result = array();
165 165
         
166
-        foreach($this->warnings as $def) {
166
+        foreach ($this->warnings as $def) {
167 167
             $result[] = new Localization_Scanner_StringsCollection_Warning($def);
168 168
         }
169 169
         
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     public function countFiles() : int
179 179
     {
180 180
         $amount = 0;
181
-        foreach($this->hashes as $hash) {
181
+        foreach ($this->hashes as $hash) {
182 182
             $amount = $amount + $hash->countFiles();
183 183
         }
184 184
         
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
     {
196 196
         $hashes = array();
197 197
         
198
-        foreach($this->hashes as $hash) {
199
-            if($hash->hasSourceID($id)) {
198
+        foreach ($this->hashes as $hash) {
199
+            if ($hash->hasSourceID($id)) {
200 200
                 $hashes[] = $hash;
201 201
             }
202 202
         }
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $hashes = array();
216 216
         
217
-        foreach($this->hashes as $hash) {
218
-            if($hash->hasLanguageType($languageID)) {
217
+        foreach ($this->hashes as $hash) {
218
+            if ($hash->hasLanguageType($languageID)) {
219 219
                 $hashes[] = $hash;
220 220
             }
221 221
         }
Please login to merge, or discard this patch.
src/Localization/Scanner/StringInfo.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 class Localization_Scanner_StringInfo
6 6
 {
7
-   /**
8
-    * @var Localization_Scanner_StringsCollection
9
-    */
7
+    /**
8
+     * @var Localization_Scanner_StringsCollection
9
+     */
10 10
     protected $collection;
11 11
     
12 12
     protected $properties = array();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     
75 75
     public function getProperty($name)
76 76
     {
77
-        if(isset($this->properties[$name])) {
77
+        if (isset($this->properties[$name])) {
78 78
             return $this->properties[$name];
79 79
         }
80 80
         
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             $array['line']
124 124
         );
125 125
         
126
-        foreach($array['properties'] as $name => $value) {
126
+        foreach ($array['properties'] as $name => $value) {
127 127
             $string->setProperty($name, $value);
128 128
         }
129 129
         
Please login to merge, or discard this patch.
src/Localization/Scanner/StringHash.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $entries = array();
50 50
        
51
-        foreach($this->strings as $string) {
51
+        foreach ($this->strings as $string) {
52 52
             $entries[] = $string->toArray();
53 53
         }
54 54
         
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $amount = 0;
70 70
         
71
-        foreach($this->strings as $string) {
72
-            if($string->isFile()) {
71
+        foreach ($this->strings as $string) {
72
+            if ($string->isFile()) {
73 73
                 $amount++;
74 74
             }
75 75
         }
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     
85 85
     public function hasLanguageType(string $type) : bool
86 86
     {
87
-        foreach($this->strings as $string) {
88
-            if($string->getLanguageType() == $type) {
87
+        foreach ($this->strings as $string) {
88
+            if ($string->getLanguageType() == $type) {
89 89
                 return true;
90 90
             }
91 91
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     
96 96
     public function getText() : string
97 97
     {
98
-        if(isset($this->strings[0])) {
98
+        if (isset($this->strings[0])) {
99 99
             return $this->strings[0]->getText();
100 100
         }
101 101
         
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $translator = Localization::getTranslator();
128 128
         $text = $translator->getHashTranslation($this->getHash());
129 129
         
130
-        if($text !== null) {
130
+        if ($text !== null) {
131 131
             return $text;
132 132
         }
133 133
         
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $files = array();
144 144
         
145
-        foreach($this->strings as $string) 
145
+        foreach ($this->strings as $string) 
146 146
         {
147
-            if(!$string->isFile()) {
147
+            if (!$string->isFile()) {
148 148
                 continue;
149 149
             }
150 150
             
151 151
             $file = $string->getSourceFile();
152
-            if(!in_array($file, $files)) {
152
+            if (!in_array($file, $files)) {
153 153
                 $files[] = $file;
154 154
             }
155 155
         }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $files = $this->getFiles();
169 169
         $result = array();
170 170
         
171
-        foreach($files as $path) {
171
+        foreach ($files as $path) {
172 172
             $result[] = basename($path);
173 173
         }
174 174
         
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class Localization_Scanner_StringHash
15 15
 {
16
-   /**
17
-    * @var Localization_Scanner_StringsCollection
18
-    */
16
+    /**
17
+     * @var Localization_Scanner_StringsCollection
18
+     */
19 19
     protected $collection;
20 20
     
21
-   /**
22
-    * @var string
23
-    */
21
+    /**
22
+     * @var string
23
+     */
24 24
     protected $hash;
25 25
     
26
-   /**
27
-    * @var Localization_Scanner_StringInfo[]
28
-    */
26
+    /**
27
+     * @var Localization_Scanner_StringInfo[]
28
+     */
29 29
     protected $strings = array();
30 30
     
31 31
     protected $sourceIDs = array();
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
         return $entries;
56 56
     }
57 57
     
58
-   /**
59
-    * Retrieves all individual string locations where this text was found.
60
-    * @return Localization_Scanner_StringInfo[]
61
-    */
58
+    /**
59
+     * Retrieves all individual string locations where this text was found.
60
+     * @return Localization_Scanner_StringInfo[]
61
+     */
62 62
     public function getStrings()
63 63
     {
64 64
         return $this->strings;
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
         return count($this->strings);
119 119
     }
120 120
     
121
-   /**
122
-    * Retrieves the translated text, if any.
123
-    * @return string
124
-    */
121
+    /**
122
+     * Retrieves the translated text, if any.
123
+     * @return string
124
+     */
125 125
     public function getTranslatedText() : string
126 126
     {
127 127
         $translator = Localization::getTranslator();
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
         return '';
135 135
     }
136 136
     
137
-   /**
138
-    * Retrieves a list of all file names, with relative paths.
139
-    * @return string[]
140
-    */
137
+    /**
138
+     * Retrieves a list of all file names, with relative paths.
139
+     * @return string[]
140
+     */
141 141
     public function getFiles() : array
142 142
     {
143 143
         $files = array();
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
         return $files;
160 160
     }
161 161
     
162
-   /**
163
-    * Retrieves a list of all file names this string is used in.
164
-    * @return string[]
165
-    */
162
+    /**
163
+     * Retrieves a list of all file names this string is used in.
164
+     * @return string[]
165
+     */
166 166
     public function getFileNames() : array
167 167
     {
168 168
         $files = $this->getFiles();
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
         return $result;
180 180
     }
181 181
     
182
-   /**
183
-    * Retrieves a text comprised of all strings that are relevant
184
-    * for a full text search, imploded together. Used in the search
185
-    * function to find matching strings.
186
-    * 
187
-    * @return string
188
-    */
182
+    /**
183
+     * Retrieves a text comprised of all strings that are relevant
184
+     * for a full text search, imploded together. Used in the search
185
+     * function to find matching strings.
186
+     * 
187
+     * @return string
188
+     */
189 189
     public function getSearchString() : string
190 190
     {
191 191
         $parts = array($this->getTranslatedText(), $this->getText());
Please login to merge, or discard this patch.
src/Localization/Currency/GBP.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@
 block discarded – undo
49 49
         $examples[] = '1.500';
50 50
 
51 51
         if ($decimalPositions > 0) {
52
-            $examples[] = '50,' . substr($decimals, 0, $decimalPositions);
53
-            $examples[] = '1.500,' . substr($decimals, 0, $decimalPositions);
52
+            $examples[] = '50,'.substr($decimals, 0, $decimalPositions);
53
+            $examples[] = '1.500,'.substr($decimals, 0, $decimalPositions);
54 54
         }
55 55
 
56 56
         return $examples;
Please login to merge, or discard this patch.
src/Localization/Source.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
      */
95 95
     protected function parseFile($file)
96 96
     {
97
-        $this->log(sprintf('Parsing file [' . $file . '].'));
97
+        $this->log(sprintf('Parsing file ['.$file.'].'));
98 98
         
99 99
         $language = $this->parser->parseFile($file);
100 100
         
101 101
         $texts = $language->getTexts();
102 102
         
103
-        foreach($texts as $def) 
103
+        foreach ($texts as $def) 
104 104
         {
105 105
             $this->collection->addFromFile(
106 106
                 $this->getID(),
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         
114 114
         $warnings = $language->getWarnings();
115 115
         
116
-        foreach($warnings as $warning) {
116
+        foreach ($warnings as $warning) {
117 117
             $this->collection->addWarning($warning);
118 118
         }
119 119
     }
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
         $amount = 0;
141 141
         
142 142
         $hashes = $this->getHashes($scanner);
143
-        foreach($hashes as $hash) {
143
+        foreach ($hashes as $hash) {
144 144
             $text = $translator->getHashTranslation($hash->getHash());
145
-            if(empty($text)) {
145
+            if (empty($text)) {
146 146
                 $amount++;
147 147
             }
148 148
         }
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 
7 7
 abstract class Localization_Source
8 8
 {
9
-   /**
10
-    * Human readable label for the source.
11
-    * @var string
12
-    */
9
+    /**
10
+     * Human readable label for the source.
11
+     * @var string
12
+     */
13 13
     protected $label;
14 14
     
15
-   /**
16
-    * Human readable group name to categorize the source.
17
-    * @var string
18
-    */
15
+    /**
16
+     * Human readable group name to categorize the source.
17
+     * @var string
18
+     */
19 19
     protected $group;
20 20
     
21
-   /**
22
-    * The folder in which the localization files are stored
23
-    * @var string
24
-    */
21
+    /**
22
+     * The folder in which the localization files are stored
23
+     * @var string
24
+     */
25 25
     protected $storageFolder;
26 26
     
27
-   /**
28
-    * @var string
29
-    */
27
+    /**
28
+     * @var string
29
+     */
30 30
     protected $alias;
31 31
     
32
-   /**
33
-    * Available during scanning.
34
-    * @var Localization_Scanner_StringsCollection|NULL
35
-    */
32
+    /**
33
+     * Available during scanning.
34
+     * @var Localization_Scanner_StringsCollection|NULL
35
+     */
36 36
     protected $collection;
37 37
     
38
-   /**
39
-    * Available during scanning.
40
-    * @var Localization_Parser|NULL
41
-    */
38
+    /**
39
+     * Available during scanning.
40
+     * @var Localization_Parser|NULL
41
+     */
42 42
     protected $parser;
43 43
     
44 44
     public function __construct(string $alias, string $label, string $group, string $storageFolder)
Please login to merge, or discard this patch.