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) : voidParameters| Name | Type | Description |
|---|
| $options | array | \Zend_Config | Configuration options for resource autoloader |
|---|



addResourceType(string $type, string $path, null | string $namespace = null) : \Zend_Loader_Autoloader_ResourceParameters| Name | 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_ResourceAdd 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',
),
));
Parameters| Name | Type | Description |
|---|
| $types | array | |
|---|
Returns


autoload(string $class) : mixedAttempt to autoload a class
Parameters| Name | Type | Description |
|---|
| $class | string | |
|---|
Returns| Type | Description |
|---|
| mixed | False if not matched, otherwise result if include operation |



getClassPath(string $class) : FalseHelper method to calculate the correct class path
Parameters| Name | Type | Description |
|---|
| $class | string | |
|---|
Returns| Type | Description |
|---|
| False | if not matched other wise the correct path |



getDefaultResourceType() : string | nullGet default resource type to use when calling load()
Returns| Type | Description |
|---|
| string | null | |



hasResourceType(string $type) : boolIs the requested resource type defined?
Parameters| Name | Type | Description |
|---|
| $type | string | |
|---|
Returns 


load(string $resource, string $type = null) : objectObject 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.
Parameters| Name | Type | Description |
|---|
| $resource | string | |
|---|
| $type | string | |
|---|
ReturnsThrows


setDefaultResourceType(string $type) : \Zend_Loader_Autoloader_ResourceSet default resource type to use when calling load()
Parameters| Name | Type | Description |
|---|
| $type | string | |
|---|
Returns 


setNamespace(string $namespace) : \Zend_Loader_Autoloader_ResourceSet namespace that this autoloader handles
Parameters| Name | Type | Description |
|---|
| $namespace | string | |
|---|
Returns 


setResourceTypes(array $types) : \Zend_Loader_Autoloader_ResourceOverwrite existing and set multiple resource types at once
Parameters| Name | Type | Description |
|---|
| $types | array | |
|---|
ReturnsDetails- See
-