/** * Finds the path to the file, that contains the specified class. * * @param string $class The fully-qualified class name * * @return string|false The path if found, false otherwise */ public function findFile($class) { $class = Normalizer::ns($class, false); if (isset($this->classMap[$class])) { return $this->classMap[$class]; } $index = substr($class, 0, 4); if (isset($this->indexes[$index])) { $namespace = $class; while (false !== ($pos = strrpos($namespace, '\\'))) { $namespace = substr($class, 0, $pos + 1); if (!isset($this->paths[$namespace])) { $namespace = rtrim($namespace, '\\'); continue; } $subclass = substr($class, $pos + 1); $subpath = Normalizer::path($subclass, false) . '.php'; foreach ($this->paths[$namespace] as $dir) { $path = $dir . $subpath; if (is_readable($path)) { if ($this->classRegistration) { $this->classMap[$class] = $path; } return $path; } } $namespace = rtrim($namespace, '\\'); } } if ($this->classRegistration) { $this->classMap[$class] = false; } return false; }