static function Util::findFileInIncludePath in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/Util.php \Drupal\xautoload\Util::findFileInIncludePath()
Check if a file exists, considering the full include path. Return the resolved path to that file.
Parameters
string $file: The filepath
Return value
boolean|string The resolved file path, if the file exists in the include path. FALSE, otherwise.
3 calls to Util::findFileInIncludePath()
- FindFileInjectedApi::suggestFile_checkIncludePath in src/
ClassFinder/ InjectedApi/ FindFileInjectedApi.php - Same as suggestFile(), but check the full PHP include path.
- LoadClassGetFileInjectedApi::suggestFile_checkIncludePath in src/
ClassFinder/ InjectedApi/ LoadClassGetFileInjectedApi.php - Same as suggestFile(), but check the full PHP include path.
- LoadClassInjectedAPI::suggestFile_checkIncludePath in src/
ClassFinder/ InjectedApi/ LoadClassInjectedAPI.php - Same as suggestFile(), but check the full PHP include path.
File
- src/
Util.php, line 159
Class
- Util
- A number of static methods that don't interact with any global state.
Namespace
Drupal\xautoloadCode
static function findFileInIncludePath($file) {
if (function_exists('stream_resolve_include_path')) {
// Use the PHP 5.3.1+ way of doing this.
return stream_resolve_include_path($file);
}
elseif ($file[0] === '/') {
// That's an absolute path already.
return file_exists($file) ? $file : FALSE;
}
else {
// Manually loop all candidate paths.
foreach (explode(PATH_SEPARATOR, get_include_path()) as $base_dir) {
if (file_exists($base_dir . '/' . $file)) {
return $base_dir . '/' . $file;
}
}
return FALSE;
}
}