private function ClassNotFoundFatalErrorHandler::getClassCandidates in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php \Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler::getClassCandidates()
Tries to guess the full namespace for a given class name.
By default, it looks for PSR-0 and PSR-4 classes registered via a Symfony or a Composer autoloader (that should cover all common cases).
Parameters
string $class A class name (without its namespace):
Return value
array An array of possible fully qualified class names
1 call to ClassNotFoundFatalErrorHandler::getClassCandidates()
- ClassNotFoundFatalErrorHandler::handleError in vendor/
symfony/ debug/ FatalErrorHandler/ ClassNotFoundFatalErrorHandler.php - Attempts to convert an error into an exception.
File
- vendor/
symfony/ debug/ FatalErrorHandler/ ClassNotFoundFatalErrorHandler.php, line 87
Class
- ClassNotFoundFatalErrorHandler
- ErrorHandler for classes that do not exist.
Namespace
Symfony\Component\Debug\FatalErrorHandlerCode
private function getClassCandidates($class) {
if (!is_array($functions = spl_autoload_functions())) {
return array();
}
// find Symfony and Composer autoloaders
$classes = array();
foreach ($functions as $function) {
if (!is_array($function)) {
continue;
}
// get class loaders wrapped by DebugClassLoader
if ($function[0] instanceof DebugClassLoader) {
$function = $function[0]
->getClassLoader();
// @deprecated since version 2.5. Returning an object from DebugClassLoader::getClassLoader() is deprecated.
if (is_object($function)) {
$function = array(
$function,
);
}
if (!is_array($function)) {
continue;
}
}
if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
foreach ($function[0]
->getPrefixes() as $prefix => $paths) {
foreach ($paths as $path) {
$classes = array_merge($classes, $this
->findClassInPath($path, $class, $prefix));
}
}
}
if ($function[0] instanceof ComposerClassLoader) {
foreach ($function[0]
->getPrefixesPsr4() as $prefix => $paths) {
foreach ($paths as $path) {
$classes = array_merge($classes, $this
->findClassInPath($path, $class, $prefix));
}
}
}
}
return array_unique($classes);
}