public static function ClassLoader::getClassLoader

Gets the <tt>ClassLoader</tt> from the SPL autoload stack that is responsible for (and is able to load) the class with the given name.

Parameters

string $className The name of the class.:

Return value

ClassLoader The <tt>ClassLoader</tt> for the class or NULL if no such <tt>ClassLoader</tt> exists.

1 call to ClassLoader::getClassLoader()
ClassLoaderTest::testGetClassLoader in drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php, line 250

Class

ClassLoader
A <tt>ClassLoader</tt> is an autoloader for class files that can be installed on the SPL autoload stack. It is a class loader that either loads only classes of a specific namespace or all namespaces and it is suitable for working…

Namespace

Doctrine\Common

Code

public static function getClassLoader($className) {
  foreach (spl_autoload_functions() as $loader) {
    if (is_array($loader) && $loader[0] instanceof ClassLoader && $loader[0]
      ->canLoadClass($className)) {
      return $loader[0];
    }
  }
  return null;
}