9d1c64c68d774b2ef1950798923afb5e22ada72f
9 * @var \http\Controller\Url
17 protected $refs = array();
20 * @param \http\Controller\Url $baseUrl
21 * @param mixed $paths array or string of paths with markdown references
23 function __construct(\http\Controller\Url
$baseUrl, $paths = ".") {
24 if (!is_array($paths)) {
25 $paths = explode(PATH_SEPARATOR
, $paths);
28 $this->baseUrl
= $baseUrl;
32 * @param \http\Url $requestUrl
35 function find(\http\Url
$requestUrl) {
36 $file = implode(DIRECTORY_SEPARATOR
,
37 $this->baseUrl
->params($requestUrl));
39 foreach ($this->refs
as $base) {
40 $path = new Path($base, $file);
41 if ($path->isFile()) {
47 function glob(Path
$path, $pattern, $flags = GLOB_BRACE
) {
48 if (strlen($path->getBaseDir())) {
49 return glob($path->getFullPath($pattern), $flags);
52 foreach ($this->refs
as $ref) {
53 $glob = array_merge($glob, array_map(function ($fn) use ($ref) {
54 return substr($fn, strlen($ref));
55 }, glob($ref . $pattern, $flags)));