You are here

public static function DebugUniversalClassLoader::enable in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/class-loader/DebugUniversalClassLoader.php \Symfony\Component\ClassLoader\DebugUniversalClassLoader::enable()

Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones.

File

vendor/symfony/class-loader/DebugUniversalClassLoader.php, line 29

Class

DebugUniversalClassLoader
Checks that the class is actually declared in the included file.

Namespace

Symfony\Component\ClassLoader

Code

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);
  }
}