@@ -236,7 +236,7 @@ public function enabledShareFolder()
236236 *** File System ***
237237 ****************************/
238238
239- public function getDirectories ($ path , $ sort_type = 0 )
239+ public function getDirectories ($ path , $ sort_type = ' alpha ' )
240240 {
241241 $ thumb_folder_name = config ('lfm.thumb_folder_name ' );
242242 $ all_directories = File::directories ($ path );
@@ -255,16 +255,16 @@ public function getDirectories($path, $sort_type = 0)
255255 }
256256 }
257257
258- if ($ sort_type == 0 ) {
259- uasort ($ arr_dir , array ($ this , 'cmpDirAlpha ' ));
260- } elseif ($ sort_type == 1 ) {
261- uasort ($ arr_dir , array ($ this , 'cmpDirTime ' ));
258+ if ($ sort_type == ' alpha ' ) {
259+ uasort ($ arr_dir , array ($ this , 'compareDirAlpha ' ));
260+ } elseif ($ sort_type == ' time ' ) {
261+ uasort ($ arr_dir , array ($ this , 'compareDirTime ' ));
262262 }
263263
264264 return $ arr_dir ;
265265 }
266266
267- public function getFilesWithInfo ($ path , $ sort_type = 0 )
267+ public function getFilesWithInfo ($ path , $ sort_type = ' alpha ' )
268268 {
269269 $ arr_files = [];
270270
@@ -299,10 +299,10 @@ public function getFilesWithInfo($path, $sort_type = 0)
299299 ];
300300 }
301301
302- if ($ sort_type == 0 ) {
303- uasort ($ arr_files , array ($ this , 'cmpAlpha ' ));
304- } elseif ($ sort_type == 1 ) {
305- uasort ($ arr_files , array ($ this , 'cmpTime ' ));
302+ if ($ sort_type == ' alpha ' ) {
303+ uasort ($ arr_files , array ($ this , 'compareFileAlpha ' ));
304+ } elseif ($ sort_type == ' time ' ) {
305+ uasort ($ arr_files , array ($ this , 'compareFileTime ' ));
306306 }
307307
308308 return $ arr_files ;
@@ -331,38 +331,42 @@ public function fileIsImage($file)
331331 return starts_with ($ mime_type , 'image ' );
332332 }
333333
334- private static function cmpDirAlpha ($ a , $ b )
334+ private static function compareDirAlpha ($ a , $ b )
335335 {
336336 $ cmp = strcmp ($ a ->name , $ b ->name );
337337
338- if ($ cmp == 0 )
338+ if ($ cmp == 0 ) {
339339 return 0 ;
340+ }
340341
341342 return ($ cmp > 0 ) ? 1 : -1 ;
342343 }
343344
344- private static function cmpDirTime ($ a , $ b )
345+ private static function compareDirTime ($ a , $ b )
345346 {
346- if ($ a ->updated == $ b ->updated )
347+ if ($ a ->updated == $ b ->updated ) {
347348 return 0 ;
349+ }
348350
349351 return ($ a ->updated > $ b ->updated ) ? 1 : -1 ;
350352 }
351353
352- private static function cmpAlpha ($ a , $ b )
354+ private static function compareFileAlpha ($ a , $ b )
353355 {
354356 $ cmp = strcmp ($ a ['name ' ], $ b ['name ' ]);
355357
356- if ($ cmp == 0 )
358+ if ($ cmp == 0 ) {
357359 return 0 ;
360+ }
358361
359362 return ($ cmp > 0 ) ? 1 : -1 ;
360363 }
361364
362- private static function cmpTime ($ a , $ b )
365+ private static function compareFileTime ($ a , $ b )
363366 {
364- if ($ a ['updated ' ] == $ b ['updated ' ])
367+ if ($ a ['updated ' ] == $ b ['updated ' ]) {
365368 return 0 ;
369+ }
366370
367371 return ($ a ['updated ' ] > $ b ['updated ' ]) ? 1 : -1 ;
368372 }
0 commit comments