Elgg
Version 6.1
|
A class/interface/trait autoloader for PHP. More...
Public Member Functions | |
__construct (protected Config $config) | |
Constructor. More... | |
getClassMap () | |
Get the class map. More... | |
getNamespaces () | |
Gets the configured namespaces. More... | |
getPrefixes () | |
Gets the configured class prefixes. More... | |
registerNamespaces (array $namespaces) | |
Registers an array of namespaces. More... | |
registerNamespace ($namespace, $paths) | |
Registers a namespace. More... | |
registerPrefixes (array $classes) | |
Registers an array of classes using the PEAR naming convention. More... | |
registerPrefix ($prefix, $paths) | |
Registers a set of classes using the PEAR naming convention. More... | |
addFallback ($path) | |
Add a directory to search if no registered directory is found. More... | |
register () | |
Registers this instance as an autoloader. More... | |
loadClass ($class) | |
Loads the given class or interface, possibly updating the class map. More... | |
findFile ($class) | |
Finds the path to the file where the class is defined. More... | |
Protected Attributes | |
array | $namespaces = [] |
array | $prefixes = [] |
array | $fallbacks = [] |
$map | |
array | $missing = [] |
A class/interface/trait autoloader for PHP.
It is able to load classes that use either:
Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be looked for in a list of locations to ease the vendoring of a sub-set of classes for large projects.
All discovered files are stored in the internal class map and the map is queried before attempting to find a file.
Contains code from Symfony2's UniversalClassLoader.
Copyright (c) 2004-2013 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition at line 48 of file ClassLoader.php.
Elgg\ClassLoader::__construct | ( | protected Config | $config | ) |
Constructor.
\Elgg\Config | $config | Site config |
Definition at line 71 of file ClassLoader.php.
Elgg\ClassLoader::addFallback | ( | $path | ) |
Add a directory to search if no registered directory is found.
string | $path | The directory |
Definition at line 161 of file ClassLoader.php.
Elgg\ClassLoader::findFile | ( | $class | ) |
Finds the path to the file where the class is defined.
string | $class | The name of the class |
Definition at line 211 of file ClassLoader.php.
Elgg\ClassLoader::getClassMap | ( | ) |
Elgg\ClassLoader::getNamespaces | ( | ) |
Gets the configured namespaces.
Definition at line 91 of file ClassLoader.php.
Elgg\ClassLoader::getPrefixes | ( | ) |
Gets the configured class prefixes.
Definition at line 100 of file ClassLoader.php.
Elgg\ClassLoader::loadClass | ( | $class | ) |
Loads the given class or interface, possibly updating the class map.
string | $class | The name of the class |
Definition at line 181 of file ClassLoader.php.
Elgg\ClassLoader::register | ( | ) |
Registers this instance as an autoloader.
Definition at line 170 of file ClassLoader.php.
Elgg\ClassLoader::registerNamespace | ( | $namespace, | |
$paths | |||
) |
Registers a namespace.
string | $namespace | The namespace |
array | string | $paths | The location(s) of the namespace |
Definition at line 125 of file ClassLoader.php.
Elgg\ClassLoader::registerNamespaces | ( | array | $namespaces | ) |
Registers an array of namespaces.
array | $namespaces | An array of namespaces (namespaces as keys and locations as values) |
Definition at line 111 of file ClassLoader.php.
Elgg\ClassLoader::registerPrefix | ( | $prefix, | |
$paths | |||
) |
Registers a set of classes using the PEAR naming convention.
string | $prefix | The classes prefix |
array | string | $paths | The location(s) of the classes |
Definition at line 150 of file ClassLoader.php.
Elgg\ClassLoader::registerPrefixes | ( | array | $classes | ) |
Registers an array of classes using the PEAR naming convention.
array | $classes | An array of classes (prefixes as keys and locations as values) |
Definition at line 136 of file ClassLoader.php.
|
protected |
Definition at line 54 of file ClassLoader.php.
|
protected |
Definition at line 59 of file ClassLoader.php.
|
protected |
Definition at line 64 of file ClassLoader.php.
|
protected |
Definition at line 50 of file ClassLoader.php.
|
protected |
Definition at line 52 of file ClassLoader.php.