You are here

public static function DebugClassLoader::enable in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/debug/DebugClassLoader.php \Symfony\Component\Debug\DebugClassLoader::enable()
  2. 8 vendor/symfony/class-loader/DebugClassLoader.php \Symfony\Component\ClassLoader\DebugClassLoader::enable()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/debug/DebugClassLoader.php \Symfony\Component\Debug\DebugClassLoader::enable()

Wraps all autoloaders.

3 calls to DebugClassLoader::enable()
Debug::enable in vendor/symfony/debug/Debug.php
Enables the debug tools.
DebugClassLoaderTest::setUp in vendor/symfony/debug/Tests/DebugClassLoaderTest.php
DebugClassLoaderTest::testIdempotence in vendor/symfony/debug/Tests/DebugClassLoaderTest.php

File

vendor/symfony/debug/DebugClassLoader.php, line 71

Class

DebugClassLoader
Autoloader checking if the class is really defined in the file found.

Namespace

Symfony\Component\Debug

Code

public static function enable() {

  // Ensures we don't hit https://bugs.php.net/42098
  class_exists('Symfony\\Component\\Debug\\ErrorHandler');
  class_exists('Psr\\Log\\LogLevel');
  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 self) {
      $function = array(
        new static($function),
        'loadClass',
      );
    }
    spl_autoload_register($function);
  }
}