From: Michael Wallner Date: Mon, 6 Oct 2014 08:28:34 +0000 (+0200) Subject: nice sorting X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=da32cc003ce0fce6fae3139e803b7550efa89ad8;p=mdref%2Fmdref nice sorting --- diff --git a/mdref/Finder.php b/mdref/Finder.php index 26397ff..e3734e3 100644 --- a/mdref/Finder.php +++ b/mdref/Finder.php @@ -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; } }