You are here

public static function ClassLoader::getClassLoader in Plug 7

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 lib/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php

File

lib/doctrine/common/lib/Doctrine/Common/ClassLoader.php, line 251

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) && ($classLoader = reset($loader)) && $classLoader instanceof ClassLoader && $classLoader
      ->canLoadClass($className)) {
      return $classLoader;
    }
  }
  return null;
}