nice sorting
authorMichael Wallner <mike@php.net>
Mon, 6 Oct 2014 08:28:34 +0000 (10:28 +0200)
committerMichael Wallner <mike@php.net>
Mon, 6 Oct 2014 08:28:34 +0000 (10:28 +0200)
mdref/Finder.php

index 26397ff316d8b243e97d751e95b5b2c0cd01b588..e3734e308ebef64e46d81a30283cbd12cb634754 100644 (file)
@@ -74,14 +74,16 @@ class Finder
         */
        function glob(Path $path, $pattern, $flags = GLOB_BRACE) {
                if (strlen($path->getBaseDir())) {
-                       return glob($path->getFullPath($pattern), $flags) ?: array();
-               }
-               $glob = array();
-               foreach ($this->refs as $ref) {
-                       $glob = array_merge($glob, array_map(function ($fn) use ($ref) {
-                               return substr($fn, strlen($ref));
-                       }, glob($ref . $pattern, $flags)));
+                       $glob = glob($path->getFullPath($pattern), $flags) ?: array();
+               } else {
+                       $glob = array();
+                       foreach ($this->refs as $ref) {
+                               $glob = array_merge($glob, array_map(function ($fn) use ($ref) {
+                                       return substr($fn, strlen($ref));
+                               }, glob($ref . $pattern, $flags)));
+                       }
                }
+               sort($glob, SORT_STRING|SORT_FLAG_CASE);
                return $glob;
        }
 }