class DebugUniversalClassLoader in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/class-loader/DebugUniversalClassLoader.php \Symfony\Component\ClassLoader\DebugUniversalClassLoader
Checks that the class is actually declared in the included file.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\ClassLoader\UniversalClassLoader
- class \Symfony\Component\ClassLoader\DebugUniversalClassLoader
Expanded class hierarchy of DebugUniversalClassLoader
Deprecated
since version 2.4, to be removed in 3.0. Use the {@link \Symfony\Component\Debug\DebugClassLoader} class instead.
File
- vendor/
symfony/ class-loader/ DebugUniversalClassLoader.php, line 24
Namespace
Symfony\Component\ClassLoaderView source
class DebugUniversalClassLoader extends UniversalClassLoader {
/**
* Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones.
*/
public static function enable() {
if (!is_array($functions = spl_autoload_functions())) {
return;
}
foreach ($functions as $function) {
spl_autoload_unregister($function);
}
foreach ($functions as $function) {
if (is_array($function) && $function[0] instanceof UniversalClassLoader) {
$loader = new static();
$loader
->registerNamespaceFallbacks($function[0]
->getNamespaceFallbacks());
$loader
->registerPrefixFallbacks($function[0]
->getPrefixFallbacks());
$loader
->registerNamespaces($function[0]
->getNamespaces());
$loader
->registerPrefixes($function[0]
->getPrefixes());
$loader
->useIncludePath($function[0]
->getUseIncludePath());
$function[0] = $loader;
}
spl_autoload_register($function);
}
}
/**
* {@inheritdoc}
*/
public function loadClass($class) {
if ($file = $this
->findFile($class)) {
require $file;
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DebugUniversalClassLoader:: |
public static | function | Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. | |
DebugUniversalClassLoader:: |
public | function |
Loads the given class or interface. Overrides UniversalClassLoader:: |
|
UniversalClassLoader:: |
private | property | ||
UniversalClassLoader:: |
private | property | ||
UniversalClassLoader:: |
private | property | ||
UniversalClassLoader:: |
private | property | ||
UniversalClassLoader:: |
private | property | ||
UniversalClassLoader:: |
public | function | Finds the path to the file where the class is defined. | 1 |
UniversalClassLoader:: |
public | function | Gets the directory(ies) to use as a fallback for namespaces. | |
UniversalClassLoader:: |
public | function | Gets the configured namespaces. | |
UniversalClassLoader:: |
public | function | Gets the configured class prefixes. | |
UniversalClassLoader:: |
public | function | Gets the directory(ies) to use as a fallback for class prefixes. | |
UniversalClassLoader:: |
public | function | Can be used to check if the autoloader uses the include path to check for classes. | |
UniversalClassLoader:: |
public | function | Registers this instance as an autoloader. | |
UniversalClassLoader:: |
public | function | Registers a namespace. | |
UniversalClassLoader:: |
public | function | Registers a directory to use as a fallback for namespaces. | |
UniversalClassLoader:: |
public | function | Registers the directory to use as a fallback for namespaces. | |
UniversalClassLoader:: |
public | function | Registers an array of namespaces. | |
UniversalClassLoader:: |
public | function | Registers a set of classes using the PEAR naming convention. | |
UniversalClassLoader:: |
public | function | Registers an array of classes using the PEAR naming convention. | |
UniversalClassLoader:: |
public | function | Registers a directory to use as a fallback for class prefixes. | |
UniversalClassLoader:: |
public | function | Registers directories to use as a fallback for class prefixes. | |
UniversalClassLoader:: |
public | function | Turns on searching the include for class files. Allows easy loading of installed PEAR packages. |