refs = $paths; $this->baseUrl = $baseUrl; } /** * @param \http\Url $requestUrl * @return Path */ function find(\http\Url $requestUrl) { $file = implode(DIRECTORY_SEPARATOR, $this->baseUrl->params($requestUrl)); foreach ($this->refs as $base) { $path = new Path($base, $file); if ($path->isFile()) { return $path; } } } function glob(Path $path, $pattern, $flags = GLOB_BRACE) { if (strlen($path->getBaseDir())) { return glob($path->getFullPath($pattern), $flags); } $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))); } return $glob; } }