@@ -129,39 +129,31 @@ public function generateMultiple($path, $format = 'es6', $multiLocales = false)
129
129
$ createdFiles = '' ;
130
130
$ dir = new DirectoryIterator ($ path );
131
131
$ jsBody = '' ;
132
- $ files = [];
133
-
134
132
foreach ($ dir as $ fileinfo ) {
135
133
if (!$ fileinfo ->isDot ()
136
134
&& !in_array ($ fileinfo ->getFilename (), array_merge (['vendor ' ], $ this ->config ['excludes ' ]))
137
135
&& $ fileinfo !== ''
138
136
) {
139
- $ files [] = $ fileinfo ->getRealPath ();
140
- }
141
- }
142
- asort ($ files );
143
-
144
- foreach ($ files as $ fileName ) {
145
- $ fileinfo = new \SplFileInfo ($ fileName );
146
- $ noExt = $ this ->removeExtension ($ fileinfo ->getFilename ());
147
- if ($ noExt !== '' ) {
148
- if (class_exists ('App ' )) {
149
- App::setLocale ($ noExt );
150
- }
151
- if (!in_array ($ noExt , $ this ->availableLocales )) {
152
- $ this ->availableLocales [] = $ noExt ;
153
- }
154
- if ($ fileinfo ->isDir ()) {
155
- $ local = $ this ->allocateLocaleArray ($ fileinfo ->getRealPath (), $ multiLocales );
156
- } else {
157
- $ local = $ this ->allocateLocaleJSON ($ fileinfo ->getRealPath ());
158
- if ($ local === null ) continue ;
159
- }
137
+ $ noExt = $ this ->removeExtension ($ fileinfo ->getFilename ());
138
+ if ($ noExt !== '' ) {
139
+ if (class_exists ('App ' )) {
140
+ App::setLocale ($ noExt );
141
+ }
142
+ if (!in_array ($ noExt , $ this ->availableLocales )) {
143
+ $ this ->availableLocales [] = $ noExt ;
144
+ }
145
+ if ($ fileinfo ->isDir ()) {
146
+ $ local = $ this ->allocateLocaleArray ($ fileinfo ->getRealPath (), $ multiLocales );
147
+ } else {
148
+ $ local = $ this ->allocateLocaleJSON ($ fileinfo ->getRealPath ());
149
+ if ($ local === null ) continue ;
150
+ }
160
151
161
- if (isset ($ locales [$ noExt ])) {
162
- $ locales [$ noExt ] = array_merge ($ local , $ locales [$ noExt ]);
163
- } else {
164
- $ locales [$ noExt ] = $ local ;
152
+ if (isset ($ locales [$ noExt ])) {
153
+ $ locales [$ noExt ] = array_merge ($ local , $ locales [$ noExt ]);
154
+ } else {
155
+ $ locales [$ noExt ] = $ local ;
156
+ }
165
157
}
166
158
}
167
159
}
@@ -217,19 +209,12 @@ private function allocateLocaleArray($path, $multiLocales = false)
217
209
$ data = [];
218
210
$ dir = new DirectoryIterator ($ path );
219
211
$ lastLocale = last ($ this ->availableLocales );
220
- $ files = [];
221
212
foreach ($ dir as $ fileinfo ) {
222
213
// Do not mess with dotfiles at all.
223
214
if ($ fileinfo ->isDot ()) {
224
215
continue ;
225
216
}
226
217
227
- $ files [] = $ fileinfo ->getRealPath ();
228
- }
229
- asort ($ files );
230
-
231
- foreach ($ files as $ fileName ) {
232
- $ fileinfo = new \SplFileInfo ($ fileName );
233
218
if ($ fileinfo ->isDir ()) {
234
219
// Recursivley iterate through subdirs, until everything is allocated.
235
220
0 commit comments