Definition at line 30 of file AutoloaderFactory.php.
◆ factory()
array All autoloaders registered using the factory |
( |
|
$options = null | ) |
|
|
static |
Factory for autoloaders
Options should be an array or Traversable object of the following structure: array( '<autoloader class="" name>="">' => $autoloaderOptions, )
The factory will then loop through and instantiate each autoloader with the specified options, and register each with the spl_autoloader.
You may retrieve the concrete autoloader instances later using getRegisteredAutoloaders().
Note that the class names must be resolvable on the include_path or via the Zend library, using PSR-0 rules (unless the class has already been loaded).
- Parameters
-
- Returns
- void
- Exceptions
-
Definition at line 71 of file AutoloaderFactory.php.
74 if (!isset(self::$loaders[self::STANDARD_AUTOLOADER])) {
76 $autoloader->register();
85 #require_once 'Exception/InvalidArgumentException.php'; 87 'Options provided must be an array or Traversable' 92 if (!isset(self::$loaders[
$class])) {
94 if (
$class == self::CLASS_MAP_AUTOLOADER) {
97 $classMapLoader = substr(
98 strrchr(self::CLASS_MAP_AUTOLOADER,
'_'), 1
101 require_once dirname(
__FILE__) .
"/$classMapLoader.php";
108 #require_once 'Exception/InvalidArgumentException.php'; 110 'Autoloader class "%s" not loaded',
117 if (version_compare(PHP_VERSION,
'5.3.7',
'>=')) {
119 #require_once 'Exception/InvalidArgumentException.php'; 121 'Autoloader class %s must implement Zend\\Loader\\SplAutoloader',
127 if (
$class === self::STANDARD_AUTOLOADER) {
132 $autoloader->register();
133 self::$loaders[
$class] = $autoloader;
is_subclass_of($obj, $className)
defined('MTF_BOOT_FILE')||define('MTF_BOOT_FILE' __FILE__
$_option $_optionId $class
const STANDARD_AUTOLOADER
static getStandardAutoloader()
◆ getRegisteredAutoloader()
static getRegisteredAutoloader |
( |
|
$class | ) |
|
|
static |
Retrieves an autoloader by class name
- Parameters
-
- Returns
- Zend_Loader_SplAutoloader
- Exceptions
-
Definition at line 159 of file AutoloaderFactory.php.
161 if (!isset(self::$loaders[
$class])) {
162 #require_once 'Exception/InvalidArgumentException.php'; 165 return self::$loaders[
$class];
$_option $_optionId $class
◆ getRegisteredAutoloaders()
static getRegisteredAutoloaders |
( |
| ) |
|
|
static |
Get an list of all autoloaders registered with the factory
Returns an array of autoloader instances.
- Returns
- array
Definition at line 147 of file AutoloaderFactory.php.
◆ getStandardAutoloader()
static getStandardAutoloader |
( |
| ) |
|
|
staticprotected |
Get an instance of the standard autoloader
Used to attempt to resolve autoloader classes, using the StandardAutoloader. The instance is marked as a fallback autoloader, to allow resolving autoloaders not under the "Zend" or "Zend" namespaces.
- Returns
- Zend_Loader_SplAutoloader
Definition at line 209 of file AutoloaderFactory.php.
211 if (
null !== self::$standardAutoloader) {
216 $stdAutoloader = substr(strrchr(self::STANDARD_AUTOLOADER,
'_'), 1);
219 #require_once dirname(__FILE__) . "/$stdAutoloader.php"; 222 self::$standardAutoloader =
$loader;
static $standardAutoloader
◆ unregisterAutoloader()
static unregisterAutoloader |
( |
|
$autoloaderClass | ) |
|
|
static |
Unregister a single autoloader by class name
- Parameters
-
- Returns
- bool
Definition at line 188 of file AutoloaderFactory.php.
190 if (!isset(self::$loaders[$autoloaderClass])) {
194 $autoloader = self::$loaders[$autoloaderClass];
195 spl_autoload_unregister(array($autoloader,
'autoload'));
196 unset(self::$loaders[$autoloaderClass]);
◆ unregisterAutoloaders()
static unregisterAutoloaders |
( |
| ) |
|
|
static |
Unregisters all autoloaders that have been registered via the factory. This will NOT unregister autoloaders registered outside of the fctory.
- Returns
- void
Definition at line 174 of file AutoloaderFactory.php.
176 foreach (self::getRegisteredAutoloaders() as
$class => $autoloader) {
177 spl_autoload_unregister(array($autoloader,
'autoload'));
178 unset(self::$loaders[
$class]);
$_option $_optionId $class
◆ $loaders
◆ $standardAutoloader
◆ CLASS_MAP_AUTOLOADER
◆ STANDARD_AUTOLOADER
The documentation for this class was generated from the following file: