Loader/StandardAutoloader.php
Zend Framework
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-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Loader
\Zend_Loader_StandardAutoloader
Package: Zend_Loader
Returns
PSR-0 compliant autoloader
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
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD {@link http://framework.zend.com/license/new-bsd}
Constants
Properties
bool $fallbackAutoloaderFlag = false
Whether or not the autoloader should also act as a fallback autoloader
Default value
false
Details- Type
- bool
array $namespaces = array()
Namespace/directory pairs to search; ZF library added by default
Default value
array()
Details- Type
- array
Methods
__construct(null | array | \Traversable $options = null) : void
Constructor
Parameters
Name | Type | Description |
---|---|---|
$options | null | array | \Traversable |
autoload(string $class) : false | string
Defined by Autoloadable; autoload a class
Parameters
Returns
Name | Type | Description |
---|---|---|
$class | string |
Type | Description |
---|---|
false | string |
handleError(mixed $errno, mixed $errstr) : void
Error handler
Used by {@link loadClass} during fallback autoloading in PHP versions
prior to 5.3.0.
ParametersName | Type | Description |
---|---|---|
$errno | mixed | |
$errstr | mixed |
isFallbackAutoloader() : bool
Is this autoloader acting as a fallback autoloader?
Returns
Type | Description |
---|---|
bool |
loadClass(string $class, string $type) : void
Load a class, based on its type (namespaced or prefixed)
Parameters
Name | Type | Description |
---|---|---|
$class | string | |
$type | string |
normalizeDirectory(string $directory) : string
Normalize the directory to include a trailing directory separator
Parameters
Returns
Name | Type | Description |
---|---|---|
$directory | string |
Type | Description |
---|---|
string |
registerNamespace(string $namespace, string $directory) : \Zend_Loader_StandardAutoloader
Register a namespace/directory pair
Parameters
Returns
Name | Type | Description |
---|---|---|
$namespace | string | |
$directory | string |
Type | Description |
---|---|
\Zend_Loader_StandardAutoloader |
registerNamespaces(array $namespaces) : \Zend_Loader_StandardAutoloader
Register many namespace/directory pairs at once
Parameters
Returns
Name | Type | Description |
---|---|---|
$namespaces | array |
Type | Description |
---|---|
\Zend_Loader_StandardAutoloader |
registerPrefix(string $prefix, string $directory) : \Zend_Loader_StandardAutoloader
Register a prefix/directory pair
Parameters
Returns
Name | Type | Description |
---|---|---|
$prefix | string | |
$directory | string |
Type | Description |
---|---|
\Zend_Loader_StandardAutoloader |
registerPrefixes(array $prefixes) : \Zend_Loader_StandardAutoloader
Register many namespace/directory pairs at once
Parameters
Returns
Name | Type | Description |
---|---|---|
$prefixes | array |
Type | Description |
---|---|
\Zend_Loader_StandardAutoloader |
setFallbackAutoloader(bool $flag) : \Zend_Loader_StandardAutoloader
Set flag indicating fallback autoloader status
Parameters
Returns
Name | Type | Description |
---|---|---|
$flag | bool |
Type | Description |
---|---|
\Zend_Loader_StandardAutoloader |
setOptions(array | \Traversable $options) : \Zend_Loader_StandardAutoloader
Configure autoloader
Allows specifying both "namespace" and "prefix" pairs, using the
following structure:
Parameters
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 |