ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
ClassLoader implements a PSR-0, PSR-4 and classmap class loader. More...
Public Member Functions | |
getPrefixes () | |
getPrefixesPsr4 () | |
getFallbackDirs () | |
getFallbackDirsPsr4 () | |
getClassMap () | |
addClassMap (array $classMap) | |
add ($prefix, $paths, $prepend=false) | |
Registers a set of PSR-0 directories for a given prefix, either appending or prepending to the ones previously set for this prefix. More... | |
addPsr4 ($prefix, $paths, $prepend=false) | |
Registers a set of PSR-4 directories for a given namespace, either appending or prepending to the ones previously set for this namespace. More... | |
set ($prefix, $paths) | |
Registers a set of PSR-0 directories for a given prefix, replacing any others previously set for this prefix. More... | |
setPsr4 ($prefix, $paths) | |
Registers a set of PSR-4 directories for a given namespace, replacing any others previously set for this namespace. More... | |
setUseIncludePath ($useIncludePath) | |
Turns on searching the include path for class files. More... | |
getUseIncludePath () | |
Can be used to check if the autoloader uses the include path to check for classes. More... | |
setClassMapAuthoritative ($classMapAuthoritative) | |
Turns off searching the prefix and fallback directories for classes that have not been registered with the class map. More... | |
isClassMapAuthoritative () | |
Should class lookup fail if not found in the current class map? More... | |
setApcuPrefix ($apcuPrefix) | |
APCu prefix to use to cache found/not-found classes, if the extension is enabled. More... | |
getApcuPrefix () | |
The APCu prefix in use, or null if APCu caching is not enabled. More... | |
register ($prepend=false) | |
Registers this instance as an autoloader. More... | |
unregister () | |
Unregisters this instance as an autoloader. More... | |
loadClass ($class) | |
Loads the given class or interface. More... | |
findFile ($class) | |
Finds the path to the file where the class is defined. More... | |
Private Member Functions | |
findFileWithExtension ($class, $ext) | |
Private Attributes | |
$prefixLengthsPsr4 = array() | |
$prefixDirsPsr4 = array() | |
$fallbackDirsPsr4 = array() | |
$prefixesPsr0 = array() | |
$fallbackDirsPsr0 = array() | |
$useIncludePath = false | |
$classMap = array() | |
$classMapAuthoritative = false | |
$missingClasses = array() | |
$apcuPrefix | |
ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
$loader = new ();
// register classes with namespaces $loader->add('Symfony', DIR.'/component'); $loader->add('Symfony', DIR.'/framework');
// activate the autoloader $loader->register();
// to enable searching the include path (eg. for PEAR packages) $loader->setUseIncludePath(true);
In this example, if you try to use a class in the Symfony namespace or one of its children (Symfony for instance), the autoloader will first look for the class under the component/ directory, and it will then fallback to the framework/ directory if not found before giving up.
This class is loosely based on the Symfony UniversalClassLoader.
Definition at line 43 of file ClassLoader.php.
Composer\Autoload\ClassLoader::add | ( | $prefix, | |
$paths, | |||
$prepend = false |
|||
) |
Registers a set of PSR-0 directories for a given prefix, either appending or prepending to the ones previously set for this prefix.
string | $prefix | The prefix |
array | string | $paths | The PSR-0 root directories |
bool | $prepend | Whether to prepend the directories |
Definition at line 109 of file ClassLoader.php.
References array.
Composer\Autoload\ClassLoader::addClassMap | ( | array | $classMap | ) |
array | $classMap | Class to filename map |
Definition at line 92 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$classMap.
Composer\Autoload\ClassLoader::addPsr4 | ( | $prefix, | |
$paths, | |||
$prepend = false |
|||
) |
Registers a set of PSR-4 directories for a given namespace, either appending or prepending to the ones previously set for this namespace.
string | $prefix | The prefix/namespace, with trailing '\' |
array | string | $paths | The PSR-4 base directories |
bool | $prepend | Whether to prepend the directories |
Definition at line 156 of file ClassLoader.php.
References array.
Composer\Autoload\ClassLoader::findFile | ( | $class | ) |
Finds the path to the file where the class is defined.
string | $class | The name of the class |
Definition at line 335 of file ClassLoader.php.
References $file, defined, and Composer\Autoload\ClassLoader\findFileWithExtension().
Referenced by Composer\Autoload\ClassLoader\loadClass().
|
private |
Definition at line 370 of file ClassLoader.php.
References $file.
Referenced by Composer\Autoload\ClassLoader\findFile().
Composer\Autoload\ClassLoader::getApcuPrefix | ( | ) |
The APCu prefix in use, or null if APCu caching is not enabled.
Definition at line 290 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$apcuPrefix.
Composer\Autoload\ClassLoader::getClassMap | ( | ) |
Composer\Autoload\ClassLoader::getFallbackDirs | ( | ) |
Definition at line 74 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$fallbackDirsPsr0.
Composer\Autoload\ClassLoader::getFallbackDirsPsr4 | ( | ) |
Definition at line 79 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$fallbackDirsPsr4.
Composer\Autoload\ClassLoader::getPrefixes | ( | ) |
Composer\Autoload\ClassLoader::getPrefixesPsr4 | ( | ) |
Definition at line 69 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$prefixDirsPsr4.
Composer\Autoload\ClassLoader::getUseIncludePath | ( | ) |
Can be used to check if the autoloader uses the include path to check for classes.
Definition at line 249 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$useIncludePath.
Composer\Autoload\ClassLoader::isClassMapAuthoritative | ( | ) |
Should class lookup fail if not found in the current class map?
Definition at line 270 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$classMapAuthoritative.
Composer\Autoload\ClassLoader::loadClass | ( | $class | ) |
Loads the given class or interface.
string | $class | The name of the class |
Definition at line 319 of file ClassLoader.php.
References $file, Composer\Autoload\ClassLoader\findFile(), and Composer\Autoload\includeFile().
Composer\Autoload\ClassLoader::register | ( | $prepend = false | ) |
Registers this instance as an autoloader.
bool | $prepend | Whether to prepend the autoloader or not |
Definition at line 300 of file ClassLoader.php.
References array.
Composer\Autoload\ClassLoader::set | ( | $prefix, | |
$paths | |||
) |
Registers a set of PSR-0 directories for a given prefix, replacing any others previously set for this prefix.
string | $prefix | The prefix |
array | string | $paths | The PSR-0 base directories |
Definition at line 201 of file ClassLoader.php.
References array.
Composer\Autoload\ClassLoader::setApcuPrefix | ( | $apcuPrefix | ) |
APCu prefix to use to cache found/not-found classes, if the extension is enabled.
string | null | $apcuPrefix |
Definition at line 280 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$apcuPrefix.
Composer\Autoload\ClassLoader::setClassMapAuthoritative | ( | $classMapAuthoritative | ) |
Turns off searching the prefix and fallback directories for classes that have not been registered with the class map.
bool | $classMapAuthoritative |
Definition at line 260 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$classMapAuthoritative.
Composer\Autoload\ClassLoader::setPsr4 | ( | $prefix, | |
$paths | |||
) |
Registers a set of PSR-4 directories for a given namespace, replacing any others previously set for this namespace.
string | $prefix | The prefix/namespace, with trailing '\' |
array | string | $paths | The PSR-4 base directories |
Definition at line 219 of file ClassLoader.php.
References array.
Composer\Autoload\ClassLoader::setUseIncludePath | ( | $useIncludePath | ) |
Turns on searching the include path for class files.
bool | $useIncludePath |
Definition at line 238 of file ClassLoader.php.
References Composer\Autoload\ClassLoader\$useIncludePath.
Composer\Autoload\ClassLoader::unregister | ( | ) |
Unregisters this instance as an autoloader.
Definition at line 308 of file ClassLoader.php.
References array.
|
private |
Definition at line 58 of file ClassLoader.php.
Referenced by Composer\Autoload\ClassLoader\getApcuPrefix(), and Composer\Autoload\ClassLoader\setApcuPrefix().
|
private |
Definition at line 55 of file ClassLoader.php.
Referenced by Composer\Autoload\ClassLoader\addClassMap(), and Composer\Autoload\ClassLoader\getClassMap().
|
private |
Definition at line 56 of file ClassLoader.php.
Referenced by Composer\Autoload\ClassLoader\isClassMapAuthoritative(), and Composer\Autoload\ClassLoader\setClassMapAuthoritative().
|
private |
Definition at line 52 of file ClassLoader.php.
Referenced by Composer\Autoload\ClassLoader\getFallbackDirs().
|
private |
Definition at line 48 of file ClassLoader.php.
Referenced by Composer\Autoload\ClassLoader\getFallbackDirsPsr4().
|
private |
Definition at line 57 of file ClassLoader.php.
|
private |
Definition at line 47 of file ClassLoader.php.
Referenced by Composer\Autoload\ClassLoader\getPrefixesPsr4().
|
private |
Definition at line 51 of file ClassLoader.php.
|
private |
Definition at line 46 of file ClassLoader.php.
|
private |
Definition at line 54 of file ClassLoader.php.
Referenced by Composer\Autoload\ClassLoader\getUseIncludePath(), and Composer\Autoload\ClassLoader\setUseIncludePath().