From da32cc003ce0fce6fae3139e803b7550efa89ad8 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 6 Oct 2014 10:28:34 +0200 Subject: [PATCH] nice sorting --- mdref/Finder.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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; } } -- 2.30.2