3 namespace Drupal\Component\ClassFinder;
5 use Doctrine\Common\Reflection\ClassFinderInterface;
8 * A Utility class that uses active autoloaders to find a file for a class.
10 class ClassFinder implements ClassFinderInterface {
15 public function findFile($class) {
16 $loaders = spl_autoload_functions();
17 foreach ($loaders as $loader) {
18 if (is_array($loader) && isset($loader[0]) && is_object($loader[0]) && method_exists($loader[0], 'findFile')) {
19 $file = call_user_func_array([$loader[0], 'findFile'], [$class]);
20 // Different implementations return different empty values. For example,
21 // \Composer\Autoload\ClassLoader::findFile() returns FALSE whilst
22 // \Doctrine\Common\Reflection\ClassFinderInterface::findFile()
23 // documents that a NULL should be returned.