Doctrine\Common\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 together with other autoloaders in the SPL autoload stack.
If no include path is configured through the constructor or , a ClassLoader
relies on the PHP <code>include_path</code>.
- Author: Roman Borschel <roman@code-factory.org>
Synopsis
class ClassLoader
{
- // members
- protected string $fileExtension;
- protected string $namespace;
- protected string $includePath;
- protected string $namespaceSeparator;
- // methods
- public void __construct()
- public void setNamespaceSeparator()
- public string getNamespaceSeparator()
- public void setIncludePath()
- public string getIncludePath()
- public void setFileExtension()
- public string getFileExtension()
- public void register()
- public void unregister()
- public boolean loadClass()
- public boolean canLoadClass()
- public static boolean classExists()
- public static ClassLoader getClassLoader()
Members
protected
- $fileExtension — string
- $includePath — string
- $namespace — string
- $namespaceSeparator — string
Methods
public
- __construct() — Creates a new <tt>ClassLoader</tt> that loads classes of the specified namespace from the specified include path.
- canLoadClass() — Asks this ClassLoader whether it can potentially load the class (file) with the given name.
- classExists() — Checks whether a class with a given name exists. A class "exists" if it is either already defined in the current request or if there is an autoloader on the SPL autoload stack that is a) responsible for the class in question and b) is able to load a class file in which the class definition resides.
- 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.
- getFileExtension() — Gets the file extension of class files in the namespace of this ClassLoader.
- getIncludePath() — Gets the base include path for all class files in the namespace of this ClassLoader.
- getNamespaceSeparator() — Gets the namespace separator used by classes in the namespace of this ClassLoader.
- loadClass() — Loads the given class or interface.
- register() — Registers this ClassLoader on the SPL autoload stack.
- setFileExtension() — Sets the file extension of class files in the namespace of this ClassLoader.
- setIncludePath() — Sets the base include path for all class files in the namespace of this ClassLoader.
- setNamespaceSeparator() — Sets the namespace separator used by classes in the namespace of this ClassLoader.
- unregister() — Removes this ClassLoader from the SPL autoload stack.