Passed
Push — master ( 4a5f5f...d4ccbb )
by Sebastian
03:14
created
src/Localization/Currency.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
             return self::$instances[$id];
74 74
         }
75 75
 
76
-        $className = Localization_Currency::class.'_' . $id;
76
+        $className = Localization_Currency::class.'_'.$id;
77 77
 
78 78
         $country = new $className($country);
79 79
 
80
-        if($country instanceof Localization_Currency)
80
+        if ($country instanceof Localization_Currency)
81 81
         {
82 82
             return $country;
83 83
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public static function isCurrencyKnown(string $currencyName) : bool
140 140
     {
141
-        return file_exists(__DIR__ . '/Currency/' . $currencyName . '.php');
141
+        return file_exists(__DIR__.'/Currency/'.$currencyName.'.php');
142 142
     }
143 143
 
144 144
     /**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
      * @return string
351 351
      * @throws Localization_Exception
352 352
      */
353
-    public function makeReadable($number, int $decimalPositions = 2, bool $addSymbol=true) : string
353
+    public function makeReadable($number, int $decimalPositions = 2, bool $addSymbol = true) : string
354 354
     {
355 355
         if ($number === null || $number === '') {
356 356
             return '';
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 
361 361
         $number = $this->formatNumber($parsed->getFloat(), $decimalPositions);
362 362
 
363
-        if(!$addSymbol) {
363
+        if (!$addSymbol) {
364 364
             return $number;
365 365
         }
366 366
         
367 367
         if ($this->isSymbolOnFront()) {
368
-            return $this->getSymbol() . ' ' . $number;
368
+            return $this->getSymbol().' '.$number;
369 369
         }
370 370
 
371
-        return $number . ' ' . $this->getSymbol();
371
+        return $number.' '.$this->getSymbol();
372 372
     }
373 373
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -245,8 +245,7 @@
 block discarded – undo
245 245
             if ($decimals == '-') {
246 246
                 $decimals = 0;
247 247
             }
248
-        } 
249
-        else 
248
+        } else 
250 249
         {
251 250
             $decimals = 0;
252 251
             $thousands = implode('', $parts);
Please login to merge, or discard this patch.
src/Localization/Writer.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -20,29 +20,29 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Localization_Writer
22 22
 {
23
-   /**
24
-    * @var boolean
25
-    */
23
+    /**
24
+     * @var boolean
25
+     */
26 26
     private $editable = false;
27 27
     
28
-   /**
29
-    * @var array<string,string>
30
-    */
28
+    /**
29
+     * @var array<string,string>
30
+     */
31 31
     private $hashes = array();
32 32
     
33
-   /**
34
-    * @var Localization_Locale
35
-    */
33
+    /**
34
+     * @var Localization_Locale
35
+     */
36 36
     private $locale;
37 37
     
38
-   /**
39
-    * @var string
40
-    */
38
+    /**
39
+     * @var string
40
+     */
41 41
     private $fileType;
42 42
     
43
-   /**
44
-    * @var string
45
-    */
43
+    /**
44
+     * @var string
45
+     */
46 46
     private $filePath;
47 47
     
48 48
     public function __construct(Localization_Locale $locale, string $fileType, string $filePath)
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
         return $hashes;
151 151
     }
152 152
     
153
-   /**
154
-    * Sort the strings to ensure they always appear in the same order:
155
-    * first by text, and same strings by their hashes. This is important
156
-    * for strings that have the same translation to avoid them changing
157
-    * order between sorts.
158
-    *
159
-    * @param array $a
160
-    * @param array $b
161
-    * @return int
162
-    */
153
+    /**
154
+     * Sort the strings to ensure they always appear in the same order:
155
+     * first by text, and same strings by their hashes. This is important
156
+     * for strings that have the same translation to avoid them changing
157
+     * order between sorts.
158
+     *
159
+     * @param array $a
160
+     * @param array $b
161
+     * @return int
162
+     */
163 163
     public function callback_sortStrings(array $a, array $b) : int
164 164
     {
165 165
         $result = strnatcasecmp($a['text'], $b['text']);
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
@@ -12,19 +12,19 @@  discard block
 block discarded – undo
12 12
     
13 13
     const STORAGE_FORMAT_VERSION = 2;
14 14
     
15
-   /**
16
-    * @var Localization_Scanner
17
-    */
15
+    /**
16
+     * @var Localization_Scanner
17
+     */
18 18
     protected $scanner;
19 19
     
20
-   /**
21
-    * @var Localization_Scanner_StringHash[]
22
-    */
20
+    /**
21
+     * @var Localization_Scanner_StringHash[]
22
+     */
23 23
     protected $hashes = array();
24 24
     
25
-   /**
26
-    * @var array
27
-    */
25
+    /**
26
+     * @var array
27
+     */
28 28
     protected $warnings = array();
29 29
     
30 30
     public function __construct(Localization_Scanner $scanner)
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
         return new Localization_Scanner_StringInfo($this, $sourceID, $sourceType, $text);
53 53
     }
54 54
     
55
-   /**
56
-    * Adds a single translatable string.
57
-    * 
58
-    * @param Localization_Scanner_StringInfo $string
59
-    * @return Localization_Scanner_StringsCollection
60
-    */
55
+    /**
56
+     * Adds a single translatable string.
57
+     * 
58
+     * @param Localization_Scanner_StringInfo $string
59
+     * @return Localization_Scanner_StringsCollection
60
+     */
61 61
     protected function add(Localization_Scanner_StringInfo $string) : Localization_Scanner_StringsCollection
62 62
     {
63 63
         $hash = $string->getHash();
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
         return $this;
71 71
     }
72 72
     
73
-   /**
74
-    * Retrieves all available translatable strings,
75
-    * grouped by their hash to identify unique strings.
76
-    * 
77
-    * @return Localization_Scanner_StringHash[]
78
-    */
73
+    /**
74
+     * Retrieves all available translatable strings,
75
+     * grouped by their hash to identify unique strings.
76
+     * 
77
+     * @return Localization_Scanner_StringHash[]
78
+     */
79 79
     public function getHashes() : array
80 80
     {
81 81
         return array_values($this->hashes);
@@ -146,32 +146,32 @@  discard block
 block discarded – undo
146 146
         return true;
147 147
     }
148 148
     
149
-   /**
150
-    * Whether the parser reported warnings during the
151
-    * search for translatable texts.
152
-    * 
153
-    * @return bool
154
-    */
149
+    /**
150
+     * Whether the parser reported warnings during the
151
+     * search for translatable texts.
152
+     * 
153
+     * @return bool
154
+     */
155 155
     public function hasWarnings() : bool
156 156
     {
157 157
         return !empty($this->warnings);
158 158
     }
159 159
     
160
-   /**
161
-    * Retrieves the amount of warnings.
162
-    * @return int
163
-    */
160
+    /**
161
+     * Retrieves the amount of warnings.
162
+     * @return int
163
+     */
164 164
     public function countWarnings() : int
165 165
     {
166 166
         return count($this->warnings);
167 167
     }
168 168
     
169
-   /**
170
-    * Retrieves all warning messages that were added
171
-    * during the search for translatable texts, if any.
172
-    * 
173
-    * @return Localization_Scanner_StringsCollection_Warning[]
174
-    */
169
+    /**
170
+     * Retrieves all warning messages that were added
171
+     * during the search for translatable texts, if any.
172
+     * 
173
+     * @return Localization_Scanner_StringsCollection_Warning[]
174
+     */
175 175
     public function getWarnings() : array
176 176
     {
177 177
         $result = array();
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
         return $amount;
199 199
     }
200 200
     
201
-   /**
202
-    * Retrieves all string hashed for the specified source.
203
-    * 
204
-    * @param string $id
205
-    * @return Localization_Scanner_StringHash[]
206
-    */
201
+    /**
202
+     * Retrieves all string hashed for the specified source.
203
+     * 
204
+     * @param string $id
205
+     * @return Localization_Scanner_StringHash[]
206
+     */
207 207
     public function getHashesBySourceID(string $id) : array
208 208
     {
209 209
         $hashes = array();
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
         return $hashes;
218 218
     }
219 219
     
220
-   /**
221
-    * Retrieves all hashes for the specified language ID.
222
-    * 
223
-    * @param string $languageID The language ID, e.g. "PHP"
224
-    * @return Localization_Scanner_StringHash[]
225
-    */
220
+    /**
221
+     * Retrieves all hashes for the specified language ID.
222
+     * 
223
+     * @param string $languageID The language ID, e.g. "PHP"
224
+     * @return Localization_Scanner_StringHash[]
225
+     */
226 226
     public function getHashesByLanguageID(string $languageID) : array
227 227
     {
228 228
         $hashes = array();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $hash = $string->getHash();
64 64
         
65
-        if(!isset($this->hashes[$hash])) {
65
+        if (!isset($this->hashes[$hash])) {
66 66
             $this->hashes[$hash] = new Localization_Scanner_StringHash($this, $hash);
67 67
         }
68 68
         
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getHash(string $hash) : Localization_Scanner_StringHash
95 95
     {
96
-        if(isset($this->hashes[$hash])) {
96
+        if (isset($this->hashes[$hash])) {
97 97
             return $this->hashes[$hash];
98 98
         }
99 99
         
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'warnings' => array()
116 116
         );
117 117
         
118
-        foreach($this->hashes as $hash)
118
+        foreach ($this->hashes as $hash)
119 119
         {
120 120
             $data['hashes'] = array_merge($data['hashes'], $hash->toArray());
121 121
         }
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function fromArray(array $array) : bool
133 133
     {
134
-        if(!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) {
134
+        if (!isset($array['formatVersion']) || $array['formatVersion'] != self::STORAGE_FORMAT_VERSION) {
135 135
             return false;
136 136
         }
137 137
         
138
-        foreach($array['hashes'] as $entry) 
138
+        foreach ($array['hashes'] as $entry) 
139 139
         {
140 140
             $string = Localization_Scanner_StringInfo::fromArray($this, $entry);
141 141
             $this->add($string);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     {
177 177
         $result = array();
178 178
         
179
-        foreach($this->warnings as $def) {
179
+        foreach ($this->warnings as $def) {
180 180
             $result[] = new Localization_Scanner_StringsCollection_Warning($def);
181 181
         }
182 182
         
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function countFiles() : int
192 192
     {
193 193
         $amount = 0;
194
-        foreach($this->hashes as $hash) {
194
+        foreach ($this->hashes as $hash) {
195 195
             $amount = $amount + $hash->countFiles();
196 196
         }
197 197
         
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $hashes = array();
210 210
         
211
-        foreach($this->hashes as $hash) {
212
-            if($hash->hasSourceID($id)) {
211
+        foreach ($this->hashes as $hash) {
212
+            if ($hash->hasSourceID($id)) {
213 213
                 $hashes[] = $hash;
214 214
             }
215 215
         }
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $hashes = array();
229 229
         
230
-        foreach($this->hashes as $hash) {
231
-            if($hash->hasLanguageType($languageID)) {
230
+        foreach ($this->hashes as $hash) {
231
+            if ($hash->hasLanguageType($languageID)) {
232 232
                 $hashes[] = $hash;
233 233
             }
234 234
         }
Please login to merge, or discard this patch.
src/Localization/Scanner/StringHash.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class Localization_Scanner_StringHash
17 17
 {
18
-   /**
19
-    * @var Localization_Scanner_StringsCollection
20
-    */
18
+    /**
19
+     * @var Localization_Scanner_StringsCollection
20
+     */
21 21
     protected $collection;
22 22
     
23
-   /**
24
-    * @var string
25
-    */
23
+    /**
24
+     * @var string
25
+     */
26 26
     protected $hash;
27 27
     
28
-   /**
29
-    * @var Localization_Scanner_StringInfo[]
30
-    */
28
+    /**
29
+     * @var Localization_Scanner_StringInfo[]
30
+     */
31 31
     protected $strings = array();
32 32
 
33 33
     /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
         return $entries;
61 61
     }
62 62
     
63
-   /**
64
-    * Retrieves all individual string locations where this text was found.
65
-    * @return Localization_Scanner_StringInfo[]
66
-    */
63
+    /**
64
+     * Retrieves all individual string locations where this text was found.
65
+     * @return Localization_Scanner_StringInfo[]
66
+     */
67 67
     public function getStrings() : array
68 68
     {
69 69
         return $this->strings;
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
         return count($this->strings);
124 124
     }
125 125
     
126
-   /**
127
-    * Retrieves the translated text, if any.
128
-    * @return string
129
-    */
126
+    /**
127
+     * Retrieves the translated text, if any.
128
+     * @return string
129
+     */
130 130
     public function getTranslatedText() : string
131 131
     {
132 132
         $translator = Localization::getTranslator();
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
         return '';
140 140
     }
141 141
     
142
-   /**
143
-    * Retrieves a list of all file names, with relative paths.
144
-    * @return string[]
145
-    */
142
+    /**
143
+     * Retrieves a list of all file names, with relative paths.
144
+     * @return string[]
145
+     */
146 146
     public function getFiles() : array
147 147
     {
148 148
         $files = array();
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
         return $files;
165 165
     }
166 166
     
167
-   /**
168
-    * Retrieves a list of all file names this string is used in.
169
-    * @return string[]
170
-    */
167
+    /**
168
+     * Retrieves a list of all file names this string is used in.
169
+     * @return string[]
170
+     */
171 171
     public function getFileNames() : array
172 172
     {
173 173
         $files = $this->getFiles();
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
         return $result;
185 185
     }
186 186
     
187
-   /**
188
-    * Retrieves a text comprised of all strings that are relevant
189
-    * for a full text search, imploded together. Used in the search
190
-    * function to find matching strings.
191
-    * 
192
-    * @return string
193
-    */
187
+    /**
188
+     * Retrieves a text comprised of all strings that are relevant
189
+     * for a full text search, imploded together. Used in the search
190
+     * function to find matching strings.
191
+     * 
192
+     * @return string
193
+     */
194 194
     public function getSearchString() : string
195 195
     {
196 196
         $parts = array($this->getTranslatedText(), $this->getText());
Please login to merge, or discard this patch.
src/Localization/Generator.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,24 +17,24 @@  discard block
 block discarded – undo
17 17
     const FILES_LOCALES = 'locales';
18 18
     const FILES_CACHE_KEY = 'cachekey';
19 19
     
20
-   /**
21
-    * @var bool
22
-    */
20
+    /**
21
+     * @var bool
22
+     */
23 23
     protected $force = false;
24 24
     
25
-   /**
26
-    * @var Localization_Translator
27
-    */
25
+    /**
26
+     * @var Localization_Translator
27
+     */
28 28
     protected $translator;
29 29
     
30
-   /**
31
-    * @var string
32
-    */
30
+    /**
31
+     * @var string
32
+     */
33 33
     protected $targetFolder;
34 34
     
35
-   /**
36
-    * @var string
37
-    */
35
+    /**
36
+     * @var string
37
+     */
38 38
     protected $cacheKeyFile;
39 39
 
40 40
     /**
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
         $this->writeCacheKey();
120 120
     }
121 121
     
122
-   /**
123
-    * Retrieves a list of all localization client 
124
-    * files that are written to disk. This includes
125
-    * the locale files and the libraries required
126
-    * to make it work clientside.
127
-    * 
128
-    * @return string[]
129
-    */
122
+    /**
123
+     * Retrieves a list of all localization client 
124
+     * files that are written to disk. This includes
125
+     * the locale files and the libraries required
126
+     * to make it work clientside.
127
+     * 
128
+     * @return string[]
129
+     */
130 130
     public function getFilesList() : array
131 131
     {
132 132
         $files = array();
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
         $this->written[self::FILES_LOCALES] = true;
280 280
     }
281 281
     
282
-   /**
283
-    * Generates the cache key file, which is used to determine
284
-    * automatically whether the client libraries need to be 
285
-    * refreshed.
286
-    */
282
+    /**
283
+     * Generates the cache key file, which is used to determine
284
+     * automatically whether the client libraries need to be 
285
+     * refreshed.
286
+     */
287 287
     protected function writeCacheKey() : void
288 288
     {
289 289
         if(file_exists($this->cacheKeyFile) && !$this->force) {
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     protected function initCache() : void
67 67
     {
68 68
         // ignore it if it does not exist.
69
-        if(!file_exists($this->cacheKeyFile)) {
69
+        if (!file_exists($this->cacheKeyFile)) {
70 70
             return;
71 71
         }
72 72
         
@@ -78,22 +78,22 @@  discard block
 block discarded – undo
78 78
      * @throws Localization_Exception
79 79
      * @throws FileHelper_Exception
80 80
      */
81
-    public function writeFiles(bool $force=false) : void
81
+    public function writeFiles(bool $force = false) : void
82 82
     {
83 83
         // reset the write states for all files
84 84
         $fileIDs = array_keys($this->written);
85
-        foreach($fileIDs as $fileID) {
85
+        foreach ($fileIDs as $fileID) {
86 86
             $this->written[$fileID] = false;
87 87
         }
88 88
         
89 89
         // no client libraries folder set: ignore.
90
-        if(empty($this->targetFolder)) {
90
+        if (empty($this->targetFolder)) {
91 91
             return;
92 92
         }
93 93
         
94 94
         FileHelper::createFolder($this->targetFolder);
95 95
         
96
-        if(!is_writable($this->targetFolder)) 
96
+        if (!is_writable($this->targetFolder)) 
97 97
         {
98 98
             throw new Localization_Exception(
99 99
                 sprintf(
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             );
109 109
         }
110 110
         
111
-        if($this->cacheKey !== Localization::getClientLibrariesCacheKey()) {
111
+        if ($this->cacheKey !== Localization::getClientLibrariesCacheKey()) {
112 112
             $force = true;
113 113
         }
114 114
         
@@ -131,16 +131,16 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $files = array();
133 133
         
134
-        foreach($this->libraries as $fileName)
134
+        foreach ($this->libraries as $fileName)
135 135
         {
136 136
             $files[] = $this->getLibraryFilePath($fileName);
137 137
         }
138 138
         
139 139
         $locales = Localization::getAppLocales();
140 140
         
141
-        foreach($locales as $locale)
141
+        foreach ($locales as $locale)
142 142
         {
143
-            if($locale->isNative()) {
143
+            if ($locale->isNative()) {
144 144
                 continue;
145 145
             }
146 146
             
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $locales = Localization::getAppLocales();
156 156
         
157
-        foreach($locales as $locale)
157
+        foreach ($locales as $locale)
158 158
         {
159
-            if($locale->isNative()) {
159
+            if ($locale->isNative()) {
160 160
                 continue;
161 161
             }
162 162
             
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     {
181 181
         $sourceFolder = realpath(__DIR__.'/../js');
182 182
         
183
-        if($sourceFolder === false) 
183
+        if ($sourceFolder === false) 
184 184
         {
185 185
             throw new Localization_Exception(
186 186
                 'Unexpected folder structure encountered.',
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
             );
193 193
         }
194 194
         
195
-        foreach($this->libraries as $fileName)
195
+        foreach ($this->libraries as $fileName)
196 196
         {
197 197
             $targetFile = $this->getLibraryFilePath($fileName);
198 198
             
199
-            if(file_exists($targetFile) && !$this->force) {
199
+            if (file_exists($targetFile) && !$this->force) {
200 200
                 continue;
201 201
             }
202 202
             
@@ -241,16 +241,16 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $path = $this->getLocaleFilePath($locale);
243 243
         
244
-        if(file_exists($path) && !$this->force) {
244
+        if (file_exists($path) && !$this->force) {
245 245
             return;
246 246
         }
247 247
         
248 248
         $strings = $this->translator->getClientStrings($locale);
249 249
         
250 250
         $tokens = array();
251
-        foreach($strings as $hash => $text)
251
+        foreach ($strings as $hash => $text)
252 252
         {
253
-            if(empty($text)) {
253
+            if (empty($text)) {
254 254
                 continue;
255 255
             }
256 256
             
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
             );
262 262
         }
263 263
         
264
-        if(empty($tokens))
264
+        if (empty($tokens))
265 265
         {
266 266
             $content = '/* No strings found. */';
267 267
         }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     */
287 287
     protected function writeCacheKey() : void
288 288
     {
289
-        if(file_exists($this->cacheKeyFile) && !$this->force) {
289
+        if (file_exists($this->cacheKeyFile) && !$this->force) {
290 290
             return;
291 291
         }
292 292
         
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public function areFilesWritten(string $filesID) : bool
313 313
     {
314
-        if(isset($this->written[$filesID])) {
314
+        if (isset($this->written[$filesID])) {
315 315
             return $this->written[$filesID];
316 316
         }
317 317
         
Please login to merge, or discard this patch.
src/Localization/Editor/OutputBuffering.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     {
22 22
         $html = ob_get_clean();
23 23
 
24
-        if($html !== false)
24
+        if ($html !== false)
25 25
         {
26 26
             return $html;
27 27
         }
Please login to merge, or discard this patch.
src/Localization/Editor/Filters.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class Localization_Editor_Filters
25 25
 {
26
-   /**
27
-    * @var Localization_Editor
28
-    */
26
+    /**
27
+     * @var Localization_Editor
28
+     */
29 29
     protected $editor;
30 30
     
31
-   /**
32
-    * @var Request
33
-    */
31
+    /**
32
+     * @var Request
33
+     */
34 34
     
35 35
     protected $request; 
36 36
      
37
-   /**
38
-    * @var string
39
-    */
37
+    /**
38
+     * @var string
39
+     */
40 40
     protected $sessionName = 'localize_filters';
41 41
     
42
-   /**
43
-    * @var string[]
44
-    */
42
+    /**
43
+     * @var string[]
44
+     */
45 45
     protected $vars = array(
46 46
         'resetfilter' => '',
47 47
         'filter' => '',
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
             <form class="form-inline">
205 205
             	<div class="form-hiddens">
206 206
             		<?php 
207
-    					$params = $this->editor->getRequestParams();
208
-    					foreach($params as $name => $value) {
209
-    					    ?>
207
+                        $params = $this->editor->getRequestParams();
208
+                        foreach($params as $name => $value) {
209
+                            ?>
210 210
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
211 211
     					    <?php 
212
-    					}
213
-					?>
212
+                        }
213
+                    ?>
214 214
             	</div>
215 215
             	<div class="form-row">
216 216
             		<div class="col-auto">
@@ -218,42 +218,42 @@  discard block
 block discarded – undo
218 218
     		        </div>
219 219
                     <div class="col-auto">
220 220
                     	<?php
221
-                    	    echo $this->renderSelect(
222
-                    	       $this->vars['status'],
223
-                    	       array(
224
-                        	       array(
225
-                        	            'value' => '',
226
-                        	            'label' => t('Status...')
227
-                        	       ),
228
-                        	       array(
229
-                        	           'value' => 'untranslated',
230
-                        	           'label' => t('Not translated')
231
-                        	       ),
232
-                        	       array(
233
-                        	           'value' => 'translated',
234
-                        	           'label' => t('Translated')
235
-                        	       )
236
-                    	       )
237
-                    	   );
221
+                            echo $this->renderSelect(
222
+                                $this->vars['status'],
223
+                                array(
224
+                                    array(
225
+                                        'value' => '',
226
+                                        'label' => t('Status...')
227
+                                    ),
228
+                                    array(
229
+                                        'value' => 'untranslated',
230
+                                        'label' => t('Not translated')
231
+                                    ),
232
+                                    array(
233
+                                        'value' => 'translated',
234
+                                        'label' => t('Translated')
235
+                                    )
236
+                                )
237
+                            );
238 238
                     	
239
-                    	   echo $this->renderSelect(
240
-                    	       $this->vars['location'],
241
-                    	       array(
242
-                    	           array(
243
-                    	               'value' => '',
244
-                    	               'label' => t('Location...')
245
-                    	           ),
246
-                    	           array(
247
-                    	               'value' => 'client',
248
-                    	               'label' => t('Clientside')
249
-                    	           ),
250
-                    	           array(
251
-                    	               'value' => 'server',
252
-                    	               'label' => t('Serverside')
253
-                    	           )
254
-                    	       )
255
-                	       );
256
-                    	?>
239
+                            echo $this->renderSelect(
240
+                                $this->vars['location'],
241
+                                array(
242
+                                    array(
243
+                                        'value' => '',
244
+                                        'label' => t('Location...')
245
+                                    ),
246
+                                    array(
247
+                                        'value' => 'client',
248
+                                        'label' => t('Clientside')
249
+                                    ),
250
+                                    array(
251
+                                        'value' => 'server',
252
+                                        'label' => t('Serverside')
253
+                                    )
254
+                                )
255
+                            );
256
+                        ?>
257 257
                     </div>
258 258
                     <div class="col-auto">
259 259
 	    				<button type="submit" name="<?php echo $this->vars['filter'] ?>" value="yes" class="btn btn-primary mb-2" title="<?php pt('Filter the list with the selected criteria.') ?>" data-toggle="tooltip">
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
             </form>
269 269
             <p>
270 270
             	<small class="text-muted"><?php 
271
-            	   pts('Hint:'); 
272
-            	   pt('Search works in translated and untranslated text, as well as the file name.') 
273
-        	   ?></small>
271
+                    pts('Hint:'); 
272
+                    pt('Search works in translated and untranslated text, as well as the file name.') 
273
+                ?></small>
274 274
             </p>
275 275
 			<br>
276 276
         <?php
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
         $this->editor = $editor;
56 56
         $this->request = $editor->getRequest();
57 57
         
58
-        foreach($this->vars as $var => $name) {
58
+        foreach ($this->vars as $var => $name) {
59 59
             $this->vars[$var] = $this->editor->getVarName($var);
60 60
         }
61 61
 
62
-        if(!isset($_SESSION[$this->sessionName])) {
62
+        if (!isset($_SESSION[$this->sessionName])) {
63 63
             $_SESSION[$this->sessionName] = array();
64 64
         }
65 65
 
66
-        if($this->request->getBool($this->vars['resetfilter']))
66
+        if ($this->request->getBool($this->vars['resetfilter']))
67 67
         {
68 68
             $defaults = $this->getDefaultValues();
69 69
             
70
-            foreach($defaults as $name => $val) {
70
+            foreach ($defaults as $name => $val) {
71 71
                 $this->setValue($name, $val);
72 72
             }
73 73
         }
74
-        else if($this->request->getBool($this->vars['filter'])) 
74
+        else if ($this->request->getBool($this->vars['filter'])) 
75 75
         {
76 76
             $this->parseSearchTerms($this->request->getParam($this->vars['search']));
77 77
             
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
     
107 107
     protected function getValue(string $filterName) : string
108 108
     {
109
-        if(isset($_SESSION[$this->sessionName][$filterName])) {
109
+        if (isset($_SESSION[$this->sessionName][$filterName])) {
110 110
             return $_SESSION[$this->sessionName][$filterName];
111 111
         }
112 112
         
113 113
         $defaults = $this->getDefaultValues();
114
-        if(isset($defaults[$filterName])) {
114
+        if (isset($defaults[$filterName])) {
115 115
             return $defaults[$filterName];
116 116
         }
117 117
         
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     
131 131
     protected function parseSearchTerms(string $searchString) : void
132 132
     {
133
-        if(empty($searchString)) 
133
+        if (empty($searchString)) 
134 134
         {
135 135
             $this->searchTerms = array();
136 136
             $this->searchString = '';
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
         $terms = array_map('trim', $terms);
145 145
         
146 146
         $keep = array();
147
-        foreach($terms as $term) {
148
-            if(!empty($term)) {
147
+        foreach ($terms as $term) {
148
+            if (!empty($term)) {
149 149
                 $keep[] = $term;
150 150
             }
151 151
         }
@@ -156,28 +156,28 @@  discard block
 block discarded – undo
156 156
     
157 157
     public function isStringMatch(Localization_Scanner_StringHash $string) : bool
158 158
     {
159
-        if(!empty($this->searchTerms)) 
159
+        if (!empty($this->searchTerms)) 
160 160
         {
161 161
             $haystack = $string->getSearchString();
162 162
             
163
-            foreach($this->searchTerms as $term) {
164
-                if(!mb_stristr($haystack, $term)) {
163
+            foreach ($this->searchTerms as $term) {
164
+                if (!mb_stristr($haystack, $term)) {
165 165
                     return false;
166 166
                 }
167 167
             }
168 168
         }
169 169
         
170 170
         $status = $this->getValue($this->vars['status']);
171
-        if($status === 'untranslated' && $string->isTranslated()) {
171
+        if ($status === 'untranslated' && $string->isTranslated()) {
172 172
             return false;
173
-        } else if($status === 'translated' && !$string->isTranslated()) {
173
+        } else if ($status === 'translated' && !$string->isTranslated()) {
174 174
             return false;
175 175
         }
176 176
         
177 177
         $location = $this->getValue($this->vars['location']);
178
-        if($location === 'client' && !$string->hasLanguageType('Javascript')) {
178
+        if ($location === 'client' && !$string->hasLanguageType('Javascript')) {
179 179
             return false;
180
-        } else if($location === 'server' && !$string->hasLanguageType('PHP')) {
180
+        } else if ($location === 'server' && !$string->hasLanguageType('PHP')) {
181 181
             return false;
182 182
         }
183 183
         
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             	<div class="form-hiddens">
206 206
             		<?php 
207 207
     					$params = $this->editor->getRequestParams();
208
-    					foreach($params as $name => $value) {
208
+    					foreach ($params as $name => $value) {
209 209
     					    ?>
210 210
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
211 211
     					    <?php 
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
         ?>
294 294
         	<select class="form-control" name="<?php echo $filterName ?>">
295 295
         		<?php 
296
-                    foreach($entries as $entry) 
296
+                    foreach ($entries as $entry) 
297 297
                     {
298 298
                         $selected = '';
299
-                        if($entry['value'] === $value) {
299
+                        if ($entry['value'] === $value) {
300 300
                             $selected = ' selected';
301 301
                         }
302 302
                         
Please login to merge, or discard this patch.
src/Localization/Editor.php 3 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -37,54 +37,54 @@  discard block
 block discarded – undo
37 37
     const ERROR_NO_SOURCES_AVAILABLE = 40001;
38 38
     const ERROR_LOCAL_PATH_NOT_FOUND = 40002;
39 39
 
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $installPath;
44 44
     
45
-   /**
46
-    * @var Localization_Source[]
47
-    */
45
+    /**
46
+     * @var Localization_Source[]
47
+     */
48 48
     protected $sources;
49 49
     
50
-   /**
51
-    * @var Request
52
-    */
50
+    /**
51
+     * @var Request
52
+     */
53 53
     protected $request;
54 54
     
55
-   /**
56
-    * @var Localization_Source
57
-    */
55
+    /**
56
+     * @var Localization_Source
57
+     */
58 58
     protected $activeSource;
59 59
     
60
-   /**
61
-    * @var Localization_Scanner
62
-    */
60
+    /**
61
+     * @var Localization_Scanner
62
+     */
63 63
     protected $scanner;
64 64
     
65
-   /**
66
-    * @var Localization_Locale[]
67
-    */
65
+    /**
66
+     * @var Localization_Locale[]
67
+     */
68 68
     protected $appLocales = array();
69 69
     
70
-   /**
71
-    * @var Localization_Locale
72
-    */
70
+    /**
71
+     * @var Localization_Locale
72
+     */
73 73
     protected $activeAppLocale;
74 74
     
75
-   /**
76
-    * @var Localization_Editor_Filters
77
-    */
75
+    /**
76
+     * @var Localization_Editor_Filters
77
+     */
78 78
     protected $filters;
79 79
 
80
-   /**
81
-    * @var array<string,string>
82
-    */
80
+    /**
81
+     * @var array<string,string>
82
+     */
83 83
     protected $requestParams = array();
84 84
     
85
-   /**
86
-    * @var string
87
-    */
85
+    /**
86
+     * @var string
87
+     */
88 88
     protected $varPrefix = 'applocalize_';
89 89
 
90 90
     /**
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
         return $this->request;
126 126
     }
127 127
     
128
-   /**
129
-    * Adds a request parameter that will be persisted in all URLs
130
-    * within the editor. This can be used when integrating the
131
-    * editor in an existing page that needs specific request params.
132
-    * 
133
-    * @param string $name
134
-    * @param string $value
135
-    * @return Localization_Editor
136
-    */
128
+    /**
129
+     * Adds a request parameter that will be persisted in all URLs
130
+     * within the editor. This can be used when integrating the
131
+     * editor in an existing page that needs specific request params.
132
+     * 
133
+     * @param string $name
134
+     * @param string $value
135
+     * @return Localization_Editor
136
+     */
137 137
     public function addRequestParam(string $name, string $value) : Localization_Editor
138 138
     {
139 139
         $this->requestParams[$name] = $value;
@@ -295,34 +295,34 @@  discard block
 block discarded – undo
295 295
                                 	</a>
296 296
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
297 297
                                     	<?php 
298
-                                    	    foreach($this->sources as $source)
299
-                                    	    {
300
-                                    	       ?>
298
+                                            foreach($this->sources as $source)
299
+                                            {
300
+                                                ?>
301 301
                                         			<a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>">
302 302
                                         				<?php 
303
-                                            				if($source->getID() === $this->activeSource->getID()) 
304
-                                            				{
305
-                                            				    ?>
303
+                                                            if($source->getID() === $this->activeSource->getID()) 
304
+                                                            {
305
+                                                                ?>
306 306
                                             				    	<b><?php echo $source->getLabel() ?></b>
307 307
                                         				    	<?php 
308
-                                            				}
309
-                                            				else
310
-                                            				{
311
-                                            				    echo $source->getLabel();
312
-                                            				}
313
-                                        				?>
308
+                                                            }
309
+                                                            else
310
+                                                            {
311
+                                                                echo $source->getLabel();
312
+                                                            }
313
+                                                        ?>
314 314
                                         				<?php
315
-                                        				    $untranslated = $source->countUntranslated($this->scanner);
316
-                                        				    if($untranslated > 0) {
317
-                                        				        ?>
315
+                                                            $untranslated = $source->countUntranslated($this->scanner);
316
+                                                            if($untranslated > 0) {
317
+                                                                ?>
318 318
                                         				        	(<span class="text-danger" title="<?php ptex('%1$s texts have not been translated in this text source.', 'Amount of texts', $untranslated) ?>"><?php echo $untranslated ?></span>)
319 319
                                 				            	<?php 
320
-                                        				    }
321
-                                    				    ?>
320
+                                                            }
321
+                                                        ?>
322 322
                                     				</a>
323 323
                                     			<?php 
324
-                                    	    }
325
-                                	    ?>
324
+                                            }
325
+                                        ?>
326 326
                                     </div>
327 327
                                 </li>
328 328
                                 <li class="nav-item dropdown">
@@ -331,15 +331,15 @@  discard block
 block discarded – undo
331 331
                                 	</a>
332 332
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
333 333
                                     	<?php 
334
-                                    	    foreach($this->appLocales as $locale)
335
-                                    	    {
336
-                                    	       ?>
334
+                                            foreach($this->appLocales as $locale)
335
+                                            {
336
+                                                ?>
337 337
                                         			<a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>">
338 338
                                         				<?php echo $locale->getLabel() ?>
339 339
                                     				</a>
340 340
                                     			<?php 
341
-                                    	    }
342
-                                	    ?>
341
+                                            }
342
+                                        ?>
343 343
                                     </div>
344 344
                                 </li>
345 345
                                 <li class="nav-item">
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
                                     </a>
350 350
                     			</li>
351 351
                     			<?php 
352
-                        			if($this->scanner->hasWarnings()) {
353
-                        			    ?>
352
+                                    if($this->scanner->hasWarnings()) {
353
+                                        ?>
354 354
                         			    	<li class="nav-item">
355 355
                         			    		<a href="<?php echo $this->getWarningsURL() ?>">
356 356
                             			    		<span class="badge badge-warning" title="<?php pts('The last scan for translatable texts reported warnings.'); pts('Click for details.'); ?>" data-toggle="tooltip">
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
                         			    		</a>
361 361
                         			    	</li>
362 362
                         			    <?php 
363
-                        			}
364
-                    			?>
363
+                                    }
364
+                                ?>
365 365
                             </ul>
366 366
                         <?php 
367 367
                     }
@@ -377,36 +377,36 @@  discard block
 block discarded – undo
377 377
                         	</a>
378 378
                     	<?php 
379 379
                     }
380
-            	?>
380
+                ?>
381 381
     		</div>
382 382
 		</nav>
383 383
 		<main role="main" class="container">
384 384
 			<div>
385 385
     			<?php 
386
-    			    if(empty($this->appLocales))
387
-    			    {
388
-    			        ?>
386
+                    if(empty($this->appLocales))
387
+                    {
388
+                        ?>
389 389
     			        	<div class="alert alert-danger">
390 390
     			        		<i class="fa fa-exclamation-triangle"></i>
391 391
     			        		<b><?php pt('Nothing to translate:') ?></b>
392 392
     			        		<?php pt('No application locales were added to translate to.') ?>
393 393
     			        	</div>
394 394
     			        <?php 
395
-    			    }
396
-    			    else if($this->request->getBool($this->getVarName('warnings')))
397
-    			    {
398
-    			        echo $this->renderWarnings();
399
-    			    }
400
-    			    else
401
-    			    {
402
-    			        ?>
395
+                    }
396
+                    else if($this->request->getBool($this->getVarName('warnings')))
397
+                    {
398
+                        echo $this->renderWarnings();
399
+                    }
400
+                    else
401
+                    {
402
+                        ?>
403 403
             				<h1><?php echo $this->activeSource->getLabel() ?></h1>
404 404
             				<?php 
405
-                				if(!empty($_SESSION['localization_messages'])) 
406
-                				{
407
-                				    foreach($_SESSION['localization_messages'] as $def)
408
-                				    {
409
-                				        ?>
405
+                                if(!empty($_SESSION['localization_messages'])) 
406
+                                {
407
+                                    foreach($_SESSION['localization_messages'] as $def)
408
+                                    {
409
+                                        ?>
410 410
                 				        	<div class="alert alert-<?php echo $def['type'] ?>" role="alert">
411 411
                                         		<?php echo $def['text'] ?>
412 412
                                         		<button type="button" class="close" data-dismiss="alert" aria-label="<?php pt('Close') ?>" title="<?php pt('Dismiss this message.') ?>" data-toggle="tooltip">
@@ -414,28 +414,28 @@  discard block
 block discarded – undo
414 414
             									</button>
415 415
                                         	</div>
416 416
             				        	<?php 
417
-                				    }
417
+                                    }
418 418
                 				    
419
-                				    // reset the messages after having displayed them
420
-                				    $_SESSION['localization_messages'] = array();
421
-                				}
422
-            				?>
419
+                                    // reset the messages after having displayed them
420
+                                    $_SESSION['localization_messages'] = array();
421
+                                }
422
+                            ?>
423 423
             				<p>
424 424
             					<?php 
425
-            				        pt(
426
-                					    'You are translating to %1$s', 
427
-                					    '<span class="badge badge-info">'.
428
-                					       $this->activeAppLocale->getLabel().
429
-                				        '</span>'
425
+                                    pt(
426
+                                        'You are translating to %1$s', 
427
+                                        '<span class="badge badge-info">'.
428
+                                            $this->activeAppLocale->getLabel().
429
+                                        '</span>'
430 430
                                     );
431
-            				    ?><br>
431
+                                ?><br>
432 432
             					<?php pt('Found %1$s texts to translate.', $this->activeSource->countUntranslated($this->scanner)) ?>
433 433
             				</p>
434 434
             				<br>
435 435
             				<?php
436
-                				if(!$this->scanner->isScanAvailable()) 
437
-                				{
438
-                				    ?>
436
+                                if(!$this->scanner->isScanAvailable()) 
437
+                                {
438
+                                    ?>
439 439
                 				    	<div class="alert alert-primary" role="alert">
440 440
                                         	<b><?php pt('No texts found:') ?></b> 
441 441
                                         	<?php pt('The source folders have not been scanned yet.') ?>
@@ -447,15 +447,15 @@  discard block
 block discarded – undo
447 447
                                             </a>
448 448
                                         </p>
449 449
                 				    <?php 
450
-                				}
451
-                				else
452
-                				{
453
-                				    echo $this->filters->renderForm();
450
+                                }
451
+                                else
452
+                                {
453
+                                    echo $this->filters->renderForm();
454 454
 
455
-                				    $this->displayList();
456
-                				}
457
-        				}
458
-    				?>
455
+                                    $this->displayList();
456
+                                }
457
+                        }
458
+                    ?>
459 459
 			</div>
460 460
 		</main>
461 461
 	</body>
@@ -473,22 +473,22 @@  discard block
 block discarded – undo
473 473
         	<h1><?php pt('Warnings') ?></h1>
474 474
         	<p class="abstract">
475 475
         		<?php 
476
-        		    pts('The following shows all texts where the system decided that they cannot be translated.');
477
-       		    ?>
476
+                    pts('The following shows all texts where the system decided that they cannot be translated.');
477
+                    ?>
478 478
         	</p>
479 479
         	<dl>
480 480
         		<?php 
481
-        		    $warnings = $this->scanner->getWarnings();
481
+                    $warnings = $this->scanner->getWarnings();
482 482
         		    
483
-        		    foreach($warnings as $warning)
484
-        		    {
485
-        		        ?>
483
+                    foreach($warnings as $warning)
484
+                    {
485
+                        ?>
486 486
         		        	<dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt>
487 487
         		        	<dd><?php echo $warning->getMessage() ?></dd>
488 488
         		        <?php 
489
-        		    }
489
+                    }
490 490
         		        
491
-        		?>
491
+                ?>
492 492
         	</dl>
493 493
     	<?php 
494 494
 
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 			<form method="post">
559 559
 				<div class="form-hiddens">
560 560
 					<?php 
561
-    					$params = $this->getRequestParams();
562
-    					foreach($params as $name => $value) {
563
-    					    ?>
561
+                        $params = $this->getRequestParams();
562
+                        foreach($params as $name => $value) {
563
+                            ?>
564 564
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
565 565
     					    <?php 
566
-    					}
567
-					?>
566
+                        }
567
+                    ?>
568 568
 				</div>
569 569
             	<table class="table table-hover">
570 570
     				<thead>
@@ -577,20 +577,20 @@  discard block
 block discarded – undo
577 577
     				</thead>
578 578
     				<tbody>
579 579
     					<?php 
580
-    					    foreach($keep as $string)
581
-    					    {
582
-    					        $this->renderListEntry($string);
583
-    					    }
584
-    					?>
580
+                            foreach($keep as $string)
581
+                            {
582
+                                $this->renderListEntry($string);
583
+                            }
584
+                        ?>
585 585
     				</tbody>
586 586
     			</table>
587 587
     			<?php 
588
-        			if($pager->hasPages()) 
589
-        			{
590
-        			    $prevUrl = $this->getPaginationURL($pager->getPreviousPage());
591
-        			    $nextUrl = $this->getPaginationURL($pager->getNextPage());
588
+                    if($pager->hasPages()) 
589
+                    {
590
+                        $prevUrl = $this->getPaginationURL($pager->getPreviousPage());
591
+                        $nextUrl = $this->getPaginationURL($pager->getNextPage());
592 592
         			    
593
-        			    ?>
593
+                        ?>
594 594
         			    	<nav aria-label="<?php pt('Navigate available pages of texts.') ?>">
595 595
                                 <ul class="pagination">
596 596
                                     <li class="page-item">
@@ -599,20 +599,20 @@  discard block
 block discarded – undo
599 599
                                 		</a>
600 600
                             		</li>
601 601
                             		<?php 
602
-                            		    $numbers = $pager->getPageNumbers();
603
-                            		    foreach($numbers as $number) 
604
-                            		    {
605
-                            		        $url = $this->getPaginationURL($number);
602
+                                        $numbers = $pager->getPageNumbers();
603
+                                        foreach($numbers as $number) 
604
+                                        {
605
+                                            $url = $this->getPaginationURL($number);
606 606
                             		        
607
-                            		        ?>
607
+                                            ?>
608 608
                             		        	<li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>">
609 609
                             		        		<a class="page-link" href="<?php echo $url ?>">
610 610
                             		        			<?php echo $number ?>
611 611
                         		        			</a>
612 612
                         		        		</li>
613 613
                             		        <?php 
614
-                            		    }
615
-                            		?>
614
+                                        }
615
+                                    ?>
616 616
                                     <li class="page-item">
617 617
                                     	<a class="page-link" href="<?php echo $nextUrl ?>">
618 618
                                     		<i class="fa fa-arrow-right"></i>
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
                                 </ul>
622 622
                             </nav>
623 623
         			    <?php 
624
-        			}
625
-    			?>
624
+                    }
625
+                ?>
626 626
 				<br>
627 627
 				<p>
628 628
 					<button type="submit" name="<?php echo $this->getVarName('save') ?>" value="yes" class="btn btn-primary">
@@ -693,46 +693,46 @@  discard block
 block discarded – undo
693 693
         			<div class="files-list">
694 694
             			<p>
695 695
             				<?php 
696
-            				    $totalFiles = count($files);
696
+                                $totalFiles = count($files);
697 697
             				    
698
-            				    if($totalFiles == 1)
699
-            				    {
700
-            				        pt('Found in a single file:');
701
-            				    }
702
-            				    else
703
-            				    {
704
-            				        pt('Found in %1$s files:', $totalFiles);
705
-            				    }
706
-    				        ?>
698
+                                if($totalFiles == 1)
699
+                                {
700
+                                    pt('Found in a single file:');
701
+                                }
702
+                                else
703
+                                {
704
+                                    pt('Found in %1$s files:', $totalFiles);
705
+                                }
706
+                            ?>
707 707
             			</p>
708 708
         				<div class="files-scroller">
709 709
                 			<ul>
710 710
                 				<?php 
711
-                				    $locations = $string->getStrings();
711
+                                    $locations = $string->getStrings();
712 712
                 				    
713
-                    				foreach($locations as $location) 
714
-                    				{
715
-                    				    $file = $location->getSourceFile();
716
-                    				    $line = $location->getLine();
713
+                                    foreach($locations as $location) 
714
+                                    {
715
+                                        $file = $location->getSourceFile();
716
+                                        $line = $location->getLine();
717 717
                     				    
718
-                    				    $ext = FileHelper::getExtension($file);
718
+                                        $ext = FileHelper::getExtension($file);
719 719
                     				    
720
-                    				    if($ext == 'php') {
721
-                    				        $icon = 'fab fa-php';
722
-                    				    } else if($ext == 'js') {
723
-                    				        $icon = 'fab fa-js-square';
724
-                    				    } else {
725
-                    				        $icon = 'fas fa-file-code';
726
-                    				    }
720
+                                        if($ext == 'php') {
721
+                                            $icon = 'fab fa-php';
722
+                                        } else if($ext == 'js') {
723
+                                            $icon = 'fab fa-js-square';
724
+                                        } else {
725
+                                            $icon = 'fas fa-file-code';
726
+                                        }
727 727
                     				    
728
-                    				    ?>
728
+                                        ?>
729 729
                     				    	<li>
730 730
                     				    		<i class="<?php echo $icon ?>"></i>
731 731
                     				    		<?php echo $file ?><span class="line-number">:<?php echo $line ?></span>
732 732
                     				    	</li>
733 733
                     				    <?php 
734
-                    				}
735
-                				?>
734
+                                    }
735
+                                ?>
736 736
                 			</ul>
737 737
             			</div>
738 738
         			</div>
@@ -949,13 +949,13 @@  discard block
 block discarded – undo
949 949
         );
950 950
     }
951 951
     
952
-   /**
953
-    * Sets the application name shown in the main navigation
954
-    * in the user interface.
955
-    * 
956
-    * @param string $name
957
-    * @return Localization_Editor
958
-    */
952
+    /**
953
+     * Sets the application name shown in the main navigation
954
+     * in the user interface.
955
+     * 
956
+     * @param string $name
957
+     * @return Localization_Editor
958
+     */
959 959
     public function setAppName(string $name) : Localization_Editor
960 960
     {
961 961
         $this->setOption('appname', $name);
@@ -985,15 +985,15 @@  discard block
 block discarded – undo
985 985
         return $this;
986 986
     }
987 987
     
988
-   /**
989
-    * Sets an URL that the translators can use to go back to
990
-    * the main application, for example if it is integrated into
991
-    * an existing application.
992
-    * 
993
-    * @param string $url The URL to use for the link
994
-    * @param string $label Label of the link
995
-    * @return Localization_Editor
996
-    */
988
+    /**
989
+     * Sets an URL that the translators can use to go back to
990
+     * the main application, for example if it is integrated into
991
+     * an existing application.
992
+     * 
993
+     * @param string $url The URL to use for the link
994
+     * @param string $label Label of the link
995
+     * @return Localization_Editor
996
+     */
997 997
     public function setBackURL(string $url, string $label) : Localization_Editor
998 998
     {
999 999
         $this->setOption('back-url', $url);
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 namespace AppLocalize;
13 13
 
14
-use AppLocalize\Editor\OutputBuffering;use AppUtils\ConvertHelper;
14
+use AppLocalize\Editor\OutputBuffering; use AppUtils\ConvertHelper;
15 15
 use AppUtils\PaginationHelper;
16 16
 use AppUtils\Traits_Optionable;
17 17
 use AppUtils\Interface_Optionable;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public function __construct()
100 100
     {
101 101
         $path = realpath(__DIR__.'/../');
102
-        if($path === false)
102
+        if ($path === false)
103 103
         {
104 104
             throw new Localization_Exception(
105 105
                 'Local path not found',
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
     
153 153
     protected function initSession() : void
154 154
     {
155
-        if(session_status() != PHP_SESSION_ACTIVE) {
155
+        if (session_status() != PHP_SESSION_ACTIVE) {
156 156
             session_start();
157 157
         }
158 158
         
159
-        if(!isset($_SESSION['localization_messages'])) {
159
+        if (!isset($_SESSION['localization_messages'])) {
160 160
             $_SESSION['localization_messages'] = array();
161 161
         }
162 162
     }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     {
174 174
         $this->sources = Localization::getSources();
175 175
         
176
-        if(empty($this->sources)) 
176
+        if (empty($this->sources)) 
177 177
         {
178 178
             throw new Localization_Exception(
179 179
                 'Cannot start editor: no sources defined.',
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         }
184 184
         
185 185
         $activeID = $this->request->registerParam($this->getVarName('source'))->setEnum(Localization::getSourceIDs())->get();
186
-        if(empty($activeID)) {
186
+        if (empty($activeID)) {
187 187
             $activeID = $this->getDefaultSourceID();
188 188
         }
189 189
         
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     protected function getDefaultSourceID() : string
194 194
     {
195 195
         $default = $this->getOption('default-source');
196
-        if(!empty($default) && Localization::sourceAliasExists($default)) {
196
+        if (!empty($default) && Localization::sourceAliasExists($default)) {
197 197
             return Localization::getSourceByAlias($default)->getID();
198 198
         }
199 199
         
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
         $names = array();
206 206
         
207 207
         $locales = Localization::getAppLocales();
208
-        foreach($locales as $locale) {
209
-            if(!$locale->isNative()) {
208
+        foreach ($locales as $locale) {
209
+            if (!$locale->isNative()) {
210 210
                 $this->appLocales[] = $locale;
211 211
                 $names[] = $locale->getName();
212 212
             }
213 213
         }
214 214
         
215 215
         // use the default locale if no other is available.
216
-        if(empty($names)) {
216
+        if (empty($names)) {
217 217
             $this->activeAppLocale = Localization::getAppLocale();
218 218
             return;
219 219
         }
220 220
        
221 221
         $activeID = $this->request->registerParam($this->getVarName('locale'))->setEnum($names)->get();
222
-        if(empty($activeID)) {
222
+        if (empty($activeID)) {
223 223
             $activeID = $this->appLocales[0]->getName();
224 224
         }
225 225
         
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
         
235 235
         $this->filters = new Localization_Editor_Filters($this);
236 236
         
237
-        if($this->request->getBool($this->getVarName('scan'))) 
237
+        if ($this->request->getBool($this->getVarName('scan'))) 
238 238
         {
239 239
             $this->executeScan();
240 240
         } 
241
-        else if($this->request->getBool($this->getVarName('save'))) 
241
+        else if ($this->request->getBool($this->getVarName('save'))) 
242 242
         {
243 243
             $this->executeSave();
244 244
         }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             </button>
286 286
             <div class="collapse navbar-collapse" id="navbarsExampleDefault">
287 287
                 <?php 
288
-                    if(!empty($this->appLocales))
288
+                    if (!empty($this->appLocales))
289 289
                     {
290 290
                         ?>
291 291
                             <ul class="navbar-nav mr-auto">
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
                                 	</a>
296 296
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
297 297
                                     	<?php 
298
-                                    	    foreach($this->sources as $source)
298
+                                    	    foreach ($this->sources as $source)
299 299
                                     	    {
300 300
                                     	       ?>
301 301
                                         			<a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>">
302 302
                                         				<?php 
303
-                                            				if($source->getID() === $this->activeSource->getID()) 
303
+                                            				if ($source->getID() === $this->activeSource->getID()) 
304 304
                                             				{
305 305
                                             				    ?>
306 306
                                             				    	<b><?php echo $source->getLabel() ?></b>
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                                         				?>
314 314
                                         				<?php
315 315
                                         				    $untranslated = $source->countUntranslated($this->scanner);
316
-                                        				    if($untranslated > 0) {
316
+                                        				    if ($untranslated > 0) {
317 317
                                         				        ?>
318 318
                                         				        	(<span class="text-danger" title="<?php ptex('%1$s texts have not been translated in this text source.', 'Amount of texts', $untranslated) ?>"><?php echo $untranslated ?></span>)
319 319
                                 				            	<?php 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                                 	</a>
332 332
                                     <div class="dropdown-menu" aria-labelledby="dropdown01">
333 333
                                     	<?php 
334
-                                    	    foreach($this->appLocales as $locale)
334
+                                    	    foreach ($this->appLocales as $locale)
335 335
                                     	    {
336 336
                                     	       ?>
337 337
                                         			<a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>">
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                                     </a>
350 350
                     			</li>
351 351
                     			<?php 
352
-                        			if($this->scanner->hasWarnings()) {
352
+                        			if ($this->scanner->hasWarnings()) {
353 353
                         			    ?>
354 354
                         			    	<li class="nav-item">
355 355
                         			    		<a href="<?php echo $this->getWarningsURL() ?>">
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 ?>
369 369
                 <?php 
370 370
                     $backURL = $this->getOption('back-url');
371
-                    if(!empty($backURL)) 
371
+                    if (!empty($backURL)) 
372 372
                     {
373 373
                         ?>
374 374
                             <a href="<?php echo $backURL ?>" class="btn btn-light btn-sm">
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		<main role="main" class="container">
384 384
 			<div>
385 385
     			<?php 
386
-    			    if(empty($this->appLocales))
386
+    			    if (empty($this->appLocales))
387 387
     			    {
388 388
     			        ?>
389 389
     			        	<div class="alert alert-danger">
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     			        	</div>
394 394
     			        <?php 
395 395
     			    }
396
-    			    else if($this->request->getBool($this->getVarName('warnings')))
396
+    			    else if ($this->request->getBool($this->getVarName('warnings')))
397 397
     			    {
398 398
     			        echo $this->renderWarnings();
399 399
     			    }
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
     			        ?>
403 403
             				<h1><?php echo $this->activeSource->getLabel() ?></h1>
404 404
             				<?php 
405
-                				if(!empty($_SESSION['localization_messages'])) 
405
+                				if (!empty($_SESSION['localization_messages'])) 
406 406
                 				{
407
-                				    foreach($_SESSION['localization_messages'] as $def)
407
+                				    foreach ($_SESSION['localization_messages'] as $def)
408 408
                 				    {
409 409
                 				        ?>
410 410
                 				        	<div class="alert alert-<?php echo $def['type'] ?>" role="alert">
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
             				</p>
434 434
             				<br>
435 435
             				<?php
436
-                				if(!$this->scanner->isScanAvailable()) 
436
+                				if (!$this->scanner->isScanAvailable()) 
437 437
                 				{
438 438
                 				    ?>
439 439
                 				    	<div class="alert alert-primary" role="alert">
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
         		<?php 
481 481
         		    $warnings = $this->scanner->getWarnings();
482 482
         		    
483
-        		    foreach($warnings as $warning)
483
+        		    foreach ($warnings as $warning)
484 484
         		    {
485 485
         		        ?>
486 486
         		        	<dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt>
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
         
505 505
         $result = array();
506 506
         
507
-        foreach($strings as $string)
507
+        foreach ($strings as $string)
508 508
         {
509
-            if($this->filters->isStringMatch($string)) {
509
+            if ($this->filters->isStringMatch($string)) {
510 510
                 $result[] = $string;
511 511
             }
512 512
         }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     {
538 538
         $strings = $this->getFilteredStrings();
539 539
         
540
-        if(empty($strings))
540
+        if (empty($strings))
541 541
         {
542 542
             ?>
543 543
             	<div class="alert alert-info">
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 				<div class="form-hiddens">
560 560
 					<?php 
561 561
     					$params = $this->getRequestParams();
562
-    					foreach($params as $name => $value) {
562
+    					foreach ($params as $name => $value) {
563 563
     					    ?>
564 564
     					    	<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>">
565 565
     					    <?php 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
     				</thead>
578 578
     				<tbody>
579 579
     					<?php 
580
-    					    foreach($keep as $string)
580
+    					    foreach ($keep as $string)
581 581
     					    {
582 582
     					        $this->renderListEntry($string);
583 583
     					    }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
     				</tbody>
586 586
     			</table>
587 587
     			<?php 
588
-        			if($pager->hasPages()) 
588
+        			if ($pager->hasPages()) 
589 589
         			{
590 590
         			    $prevUrl = $this->getPaginationURL($pager->getPreviousPage());
591 591
         			    $nextUrl = $this->getPaginationURL($pager->getNextPage());
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
                             		</li>
601 601
                             		<?php 
602 602
                             		    $numbers = $pager->getPageNumbers();
603
-                            		    foreach($numbers as $number) 
603
+                            		    foreach ($numbers as $number) 
604 604
                             		    {
605 605
                             		        $url = $this->getPaginationURL($number);
606 606
                             		        
607 607
                             		        ?>
608
-                            		        	<li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>">
608
+                            		        	<li class="page-item <?php if ($pager->isCurrentPage($number)) { echo 'active'; } ?>">
609 609
                             		        		<a class="page-link" href="<?php echo $url ?>">
610 610
                             		        			<?php echo $number ?>
611 611
                         		        			</a>
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
         <?php 
636 636
     }
637 637
     
638
-    protected function getPaginationURL(int $page, array $params=array()) : string
638
+    protected function getPaginationURL(int $page, array $params = array()) : string
639 639
     {
640 640
         $params[$this->getVarName('page')] = $page;
641 641
         
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
         $text = $string->getText();
649 649
         
650 650
         $previewText = $string->getTranslatedText();
651
-        if(empty($previewText)) {
651
+        if (empty($previewText)) {
652 652
             $previewText = $text->getText();
653 653
         }
654 654
         
655
-        $shortText =  $this->renderText($previewText, 50);
655
+        $shortText = $this->renderText($previewText, 50);
656 656
         
657 657
         $files = $string->getFiles();
658 658
         
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
         			</p>
673 673
                     <?php
674 674
                         $explanation = $text->getExplanation();
675
-                        if(!empty($explanation))
675
+                        if (!empty($explanation))
676 676
                         {
677 677
                             ?>
678 678
                             <p>
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
             				<?php 
696 696
             				    $totalFiles = count($files);
697 697
             				    
698
-            				    if($totalFiles == 1)
698
+            				    if ($totalFiles == 1)
699 699
             				    {
700 700
             				        pt('Found in a single file:');
701 701
             				    }
@@ -710,16 +710,16 @@  discard block
 block discarded – undo
710 710
                 				<?php 
711 711
                 				    $locations = $string->getStrings();
712 712
                 				    
713
-                    				foreach($locations as $location) 
713
+                    				foreach ($locations as $location) 
714 714
                     				{
715 715
                     				    $file = $location->getSourceFile();
716 716
                     				    $line = $location->getLine();
717 717
                     				    
718 718
                     				    $ext = FileHelper::getExtension($file);
719 719
                     				    
720
-                    				    if($ext == 'php') {
720
+                    				    if ($ext == 'php') {
721 721
                     				        $icon = 'fab fa-php';
722
-                    				    } else if($ext == 'js') {
722
+                    				    } else if ($ext == 'js') {
723 723
                     				        $icon = 'fab fa-js-square';
724 724
                     				    } else {
725 725
                     				        $icon = 'fas fa-file-code';
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
         <?php 
742 742
     }
743 743
     
744
-    protected function renderText(string $text, int $cutAt=0) : string
744
+    protected function renderText(string $text, int $cutAt = 0) : string
745 745
     {
746
-        if(empty($text)) {
746
+        if (empty($text)) {
747 747
             return '';
748 748
         }
749 749
 
750
-        if($cutAt > 0) {
750
+        if ($cutAt > 0) {
751 751
             $text = ConvertHelper::text_cut($text, $cutAt);
752 752
         }
753 753
 
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         
756 756
         $vars = $this->detectVariables($text);
757 757
         
758
-        foreach($vars as $var) {
758
+        foreach ($vars as $var) {
759 759
             $text = str_replace($var, '<span class="placeholder">'.$var.'</span>', $text);
760 760
         }
761 761
         
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
         $result = array();
768 768
         preg_match_all('/%[0-9]+d|%s|%[0-9]+\$s/i', $string, $result, PREG_PATTERN_ORDER);
769 769
 
770
-        if(isset($result[0]) && !empty($result[0])) {
770
+        if (isset($result[0]) && !empty($result[0])) {
771 771
             return $result[0];
772 772
         }
773 773
         
@@ -783,10 +783,10 @@  discard block
 block discarded – undo
783 783
         
784 784
         // add a counter of the additional files if the total
785 785
         // is higher than the maximum to show
786
-        if($total > $max) 
786
+        if ($total > $max) 
787 787
         {
788 788
             $length = $max;
789
-            if($length > $keepTotal) {
789
+            if ($length > $keepTotal) {
790 790
                 $length = $keepTotal; 
791 791
             }
792 792
             
@@ -814,14 +814,14 @@  discard block
 block discarded – undo
814 814
         return FileHelper::readContents($this->installPath.'/css/editor.css');
815 815
     }
816 816
     
817
-    public function getSourceURL(Localization_Source $source, array $params=array()) : string
817
+    public function getSourceURL(Localization_Source $source, array $params = array()) : string
818 818
     {
819 819
         $params[$this->getVarName('source')] = $source->getID();
820 820
         
821 821
         return $this->getURL($params);
822 822
     }
823 823
     
824
-    public function getLocaleURL(Localization_Locale $locale, array $params=array()) : string
824
+    public function getLocaleURL(Localization_Locale $locale, array $params = array()) : string
825 825
     {
826 826
         $params[$this->getVarName('locale')] = $locale->getName();
827 827
         
@@ -838,12 +838,12 @@  discard block
 block discarded – undo
838 838
         return $this->getSourceURL($this->activeSource, array($this->getVarName('warnings') => 'yes'));
839 839
     }
840 840
     
841
-    public function getURL(array $params=array()) : string
841
+    public function getURL(array $params = array()) : string
842 842
     {
843 843
         $persist = $this->getRequestParams();
844 844
         
845
-        foreach($persist as $name => $value) {
846
-            if(!isset($params[$name])) {
845
+        foreach ($persist as $name => $value) {
846
+            if (!isset($params[$name])) {
847 847
                 $params[$name] = $value;
848 848
             }
849 849
         }
@@ -880,11 +880,11 @@  discard block
 block discarded – undo
880 880
         $translator = Localization::getTranslator($this->activeAppLocale);
881 881
         
882 882
         $strings = $data[$this->getVarName('strings')];
883
-        foreach($strings as $hash => $text) 
883
+        foreach ($strings as $hash => $text) 
884 884
         {
885 885
             $text = trim($text);
886 886
             
887
-            if(empty($text)) {
887
+            if (empty($text)) {
888 888
                 continue;
889 889
             } 
890 890
             
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
     
907 907
     protected function renderStatus(Localization_Scanner_StringHash $hash) : string
908 908
     {
909
-        if($hash->isTranslated()) {
909
+        if ($hash->isTranslated()) {
910 910
             return '<i class="fa fa-check text-success"></i>';
911 911
         }        
912 912
         
@@ -917,18 +917,18 @@  discard block
 block discarded – undo
917 917
     {
918 918
         $types = array();
919 919
         
920
-        if($hash->hasLanguageType('PHP')) {
920
+        if ($hash->hasLanguageType('PHP')) {
921 921
             $types[] = t('Server');
922 922
         }
923 923
         
924
-        if($hash->hasLanguageType('Javascript')) {
924
+        if ($hash->hasLanguageType('Javascript')) {
925 925
             $types[] = t('Client');
926 926
         }
927 927
         
928 928
         return implode(', ', $types);
929 929
     }
930 930
     
931
-    protected function addMessage(string $message, string $type=self::MESSAGE_INFO) : void
931
+    protected function addMessage(string $message, string $type = self::MESSAGE_INFO) : void
932 932
     {
933 933
         $_SESSION['localization_messages'][] = array(
934 934
             'text' => $message,
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
     public function getAppName() : string
966 966
     {
967 967
         $name = $this->getOption('appname');
968
-        if(!empty($name)) {
968
+        if (!empty($name)) {
969 969
             return $name;
970 970
         }
971 971
         
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -237,8 +237,7 @@  discard block
 block discarded – undo
237 237
         if($this->request->getBool($this->getVarName('scan'))) 
238 238
         {
239 239
             $this->executeScan();
240
-        } 
241
-        else if($this->request->getBool($this->getVarName('save'))) 
240
+        } else if($this->request->getBool($this->getVarName('save'))) 
242 241
         {
243 242
             $this->executeSave();
244 243
         }
@@ -305,8 +304,7 @@  discard block
 block discarded – undo
305 304
                                             				    ?>
306 305
                                             				    	<b><?php echo $source->getLabel() ?></b>
307 306
                                         				    	<?php 
308
-                                            				}
309
-                                            				else
307
+                                            				} else
310 308
                                             				{
311 309
                                             				    echo $source->getLabel();
312 310
                                             				}
@@ -392,12 +390,10 @@  discard block
 block discarded – undo
392 390
     			        		<?php pt('No application locales were added to translate to.') ?>
393 391
     			        	</div>
394 392
     			        <?php 
395
-    			    }
396
-    			    else if($this->request->getBool($this->getVarName('warnings')))
393
+    			    } else if($this->request->getBool($this->getVarName('warnings')))
397 394
     			    {
398 395
     			        echo $this->renderWarnings();
399
-    			    }
400
-    			    else
396
+    			    } else
401 397
     			    {
402 398
     			        ?>
403 399
             				<h1><?php echo $this->activeSource->getLabel() ?></h1>
@@ -447,8 +443,7 @@  discard block
 block discarded – undo
447 443
                                             </a>
448 444
                                         </p>
449 445
                 				    <?php 
450
-                				}
451
-                				else
446
+                				} else
452 447
                 				{
453 448
                 				    echo $this->filters->renderForm();
454 449
 
@@ -698,8 +693,7 @@  discard block
 block discarded – undo
698 693
             				    if($totalFiles == 1)
699 694
             				    {
700 695
             				        pt('Found in a single file:');
701
-            				    }
702
-            				    else
696
+            				    } else
703 697
             				    {
704 698
             				        pt('Found in %1$s files:', $totalFiles);
705 699
             				    }
Please login to merge, or discard this patch.