Loader/Autoloader/Resource.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
- Subpackage
- Autoloader
- Version
- $Id$
\Zend_Loader_Autoloader_Resource
Package: Zend_Loader\AutoloaderResource loader
- Implements
- Children
- \Zend_Application_Module_Autoloader
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
-
Properties



array $_components = array()
Components handled within this resource
Default valuearray()
Details- Type
- array



array $_resourceTypes = array()
Available resource types handled by this resource autoloader
Default valuearray()
Details- Type
- array
Methods



__construct(array | \Zend_Config $options) : void
ParametersName | Type | Description |
---|
$options | array | \Zend_Config | Configuration options for resource autoloader |
---|



addResourceType(string $type, string $path, null | string $namespace = null) : \Zend_Loader_Autoloader_Resource
ParametersName | Type | Description |
---|
$type | string | identifier for the resource type being loaded |
---|
$path | string | path relative to resource base path containing the resource types |
---|
$namespace | null | string | sub-component namespace to append to base namespace that qualifies this resource type |
---|
Returns 


addResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
Add multiple resources at once
$types should be an associative array of resource type => specification
pairs. Each specification should be an associative array containing
minimally the 'path' key (specifying the path relative to the resource
base path) and optionally the 'namespace' key (indicating the subcomponent
namespace to append to the resource namespace).
As an example:
$loader->addResourceTypes(array(
'model' => array(
'path' => 'models',
'namespace' => 'Model',
),
'form' => array(
'path' => 'forms',
'namespace' => 'Form',
),
));
ParametersName | Type | Description |
---|
$types | array | |
---|
Returns


autoload(string $class) : mixed
Attempt to autoload a class
ParametersName | Type | Description |
---|
$class | string | |
---|
ReturnsType | Description |
---|
mixed | False if not matched, otherwise result if include operation |



getClassPath(string $class) : False
Helper method to calculate the correct class path
ParametersName | Type | Description |
---|
$class | string | |
---|
ReturnsType | Description |
---|
False | if not matched other wise the correct path |



getDefaultResourceType() : string | null
Get default resource type to use when calling load()
ReturnsType | Description |
---|
string | null | |



hasResourceType(string $type) : bool
Is the requested resource type defined?
ParametersName | Type | Description |
---|
$type | string | |
---|
Returns 


load(string $resource, string $type = null) : object
Object registry and factory
Loads the requested resource of type $type (or uses the default resource
type if none provided). If the resource has been loaded previously,
returns the previous instance; otherwise, instantiates it.
ParametersName | Type | Description |
---|
$resource | string | |
---|
$type | string | |
---|
ReturnsThrows


setDefaultResourceType(string $type) : \Zend_Loader_Autoloader_Resource
Set default resource type to use when calling load()
ParametersName | Type | Description |
---|
$type | string | |
---|
Returns 


setNamespace(string $namespace) : \Zend_Loader_Autoloader_Resource
Set namespace that this autoloader handles
ParametersName | Type | Description |
---|
$namespace | string | |
---|
Returns 


setResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
Overwrite existing and set multiple resource types at once
ParametersName | Type | Description |
---|
$types | array | |
---|
ReturnsDetails- See
-