Loader/StandardAutoloader.php
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Loader
\Zend_Loader_StandardAutoloader
Allows autoloading both namespaced and vendor-prefixed classes. Class lookups are performed on the filesystem. If a class file for the referenced class is not found, a PHP warning will be raised by include().
- Implements
- \Zend_Loader_SplAutoloader
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD {@link http://framework.zend.com/license/new-bsd}
Constants
Properties

bool $fallbackAutoloaderFlag = falseWhether or not the autoloader should also act as a fallback autoloader
falseDetails- Type
- bool

array $namespaces = array()Namespace/directory pairs to search; ZF library added by default
array()Details- Type
- array
Methods

__construct(null | array | \Traversable $options = null) : voidConstructor
Allow configuration of the autoloader via the constructor.
| Name | Type | Description |
|---|---|---|
| $options | null | array | \Traversable |

autoload(string $class) : false | stringDefined by Autoloadable; autoload a class
| Name | Type | Description |
|---|---|---|
| $class | string |
| Type | Description |
|---|---|
| false | string |

handleError(mixed $errno, mixed $errstr) : voidError handler
Used by loadClass during fallback autoloading in PHP versions prior to 5.3.0.
| Name | Type | Description |
|---|---|---|
| $errno | mixed | |
| $errstr | mixed |

isFallbackAutoloader() : boolIs this autoloader acting as a fallback autoloader?
| Type | Description |
|---|---|
| bool |

loadClass(string $class, string $type) : voidLoad a class, based on its type (namespaced or prefixed)
| Name | Type | Description |
|---|---|---|
| $class | string | |
| $type | string |

normalizeDirectory(string $directory) : stringNormalize the directory to include a trailing directory separator
| Name | Type | Description |
|---|---|---|
| $directory | string |
| Type | Description |
|---|---|
| string |

register() : voidRegister the autoloader with spl_autoload
Typically, the body of this will simply be:
spl_autoload_register(array($this, 'autoload'));

registerNamespace(string $namespace, string $directory) : \Zend_Loader_StandardAutoloaderRegister a namespace/directory pair
| Name | Type | Description |
|---|---|---|
| $namespace | string | |
| $directory | string |
| Type | Description |
|---|---|
| \Zend_Loader_StandardAutoloader |

registerNamespaces(array $namespaces) : \Zend_Loader_StandardAutoloaderRegister many namespace/directory pairs at once
| Name | Type | Description |
|---|---|---|
| $namespaces | array |
| Type | Description |
|---|---|
| \Zend_Loader_StandardAutoloader |

registerPrefix(string $prefix, string $directory) : \Zend_Loader_StandardAutoloaderRegister a prefix/directory pair
| Name | Type | Description |
|---|---|---|
| $prefix | string | |
| $directory | string |
| Type | Description |
|---|---|
| \Zend_Loader_StandardAutoloader |

registerPrefixes(array $prefixes) : \Zend_Loader_StandardAutoloaderRegister many namespace/directory pairs at once
| Name | Type | Description |
|---|---|---|
| $prefixes | array |
| Type | Description |
|---|---|
| \Zend_Loader_StandardAutoloader |

setFallbackAutoloader(bool $flag) : \Zend_Loader_StandardAutoloaderSet flag indicating fallback autoloader status
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_Loader_StandardAutoloader |

setOptions(array | \Traversable $options) : \Zend_Loader_StandardAutoloaderConfigure autoloader
Allows specifying both "namespace" and "prefix" pairs, using the following structure:
array(
'namespaces' => array(
'Zend' => '/path/to/Zend/library',
'Doctrine' => '/path/to/Doctrine/library',
),
'prefixes' => array(
'Phly_' => '/path/to/Phly/library',
),
'fallback_autoloader' => true,
)
| Name | Type | Description |
|---|---|---|
| $options | array | \Traversable |
| Type | Description |
|---|---|
| \Zend_Loader_StandardAutoloader |