1
0
Fork 0
php-language-server/src/FilesFinder/FilesFinder.php

39 lines
835 B
PHP
Raw Normal View History

2016-12-08 01:33:48 +00:00
<?php
declare(strict_types = 1);
namespace LanguageServer\FilesFinder;
use Sabre\Event\Promise;
/**
* Interface for finding files in the workspace
*/
interface FilesFinder
{
/**
* Returns all files in the workspace that match a glob.
* If the client does not support workspace/xfiles, it falls back to searching the file system directly.
*
* @param string $glob
* @return Promise <string[]>
*/
2019-08-30 11:47:55 +00:00
public function find(string $glob, array $excludePatterns): Promise;
}
/**
* Check if a path matches any of the globs
* @param string $path
* @param string[] $globs An array of globs
* @return bool
*/
function matchGlobs(string $path, array $globs): bool
{
foreach ($globs as $glob) {
if (Glob::match($path, $glob)) {
return true;
}
}
return false;
2016-12-08 01:33:48 +00:00
}