public function UniversalClassLoader::findFile in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/class-loader/UniversalClassLoader.php \Symfony\Component\ClassLoader\UniversalClassLoader::findFile()
Finds the path to the file where the class is defined.
Parameters
string $class The name of the class:
Return value
string|null The path, if found
3 calls to UniversalClassLoader::findFile()
- ApcUniversalClassLoader::findFile in vendor/
symfony/ class-loader/ ApcUniversalClassLoader.php - Finds a file by class name while caching lookups to APC.
- DebugUniversalClassLoader::loadClass in vendor/
symfony/ class-loader/ DebugUniversalClassLoader.php - Loads the given class or interface.
- UniversalClassLoader::loadClass in vendor/
symfony/ class-loader/ UniversalClassLoader.php - Loads the given class or interface.
1 method overrides UniversalClassLoader::findFile()
- ApcUniversalClassLoader::findFile in vendor/
symfony/ class-loader/ ApcUniversalClassLoader.php - Finds a file by class name while caching lookups to APC.
File
- vendor/
symfony/ class-loader/ UniversalClassLoader.php, line 253
Class
- UniversalClassLoader
- UniversalClassLoader implements a "universal" autoloader for PHP 5.3.
Namespace
Symfony\Component\ClassLoaderCode
public function findFile($class) {
if (false !== ($pos = strrpos($class, '\\'))) {
// namespaced class name
$namespace = substr($class, 0, $pos);
$className = substr($class, $pos + 1);
$normalizedClass = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
foreach ($this->namespaces as $ns => $dirs) {
if (0 !== strpos($namespace, $ns)) {
continue;
}
foreach ($dirs as $dir) {
$file = $dir . DIRECTORY_SEPARATOR . $normalizedClass;
if (is_file($file)) {
return $file;
}
}
}
foreach ($this->namespaceFallbacks as $dir) {
$file = $dir . DIRECTORY_SEPARATOR . $normalizedClass;
if (is_file($file)) {
return $file;
}
}
}
else {
// PEAR-like class name
$normalizedClass = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
foreach ($this->prefixes as $prefix => $dirs) {
if (0 !== strpos($class, $prefix)) {
continue;
}
foreach ($dirs as $dir) {
$file = $dir . DIRECTORY_SEPARATOR . $normalizedClass;
if (is_file($file)) {
return $file;
}
}
}
foreach ($this->prefixFallbacks as $dir) {
$file = $dir . DIRECTORY_SEPARATOR . $normalizedClass;
if (is_file($file)) {
return $file;
}
}
}
if ($this->useIncludePath && ($file = stream_resolve_include_path($normalizedClass))) {
return $file;
}
}