Application/Module/Autoloader.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Application  
Subpackage
Module  
Version
$Id: Autoloader.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Application_Module_Autoloader

Package: Zend\Application\Module
Resource loader for application module classes
Parent(s)
\Zend_Loader_Autoloader_Resource
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
\global\Zend_Loader_Autoloader_Resource  

Properties

>VPropertyprotectedstring $_basePath
inherited

Base path to resource classes

Inherited from: \Zend_Loader_Autoloader_Resource::$$_basePath
Details
Type
string
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_basePath  
>VPropertyprotectedarray $_components = array()
inherited

Components handled within this resource

Inherited from: \Zend_Loader_Autoloader_Resource::$$_components
Default valuearray()Details
Type
array
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_components  
>VPropertyprotectedstring $_defaultResourceType
inherited

Default resource/component to use when using object registry

Inherited from: \Zend_Loader_Autoloader_Resource::$$_defaultResourceType
>VPropertyprotectedstring $_namespace
inherited

Namespace of classes within this resource

Inherited from: \Zend_Loader_Autoloader_Resource::$$_namespace
Details
Type
string
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_namespace  
>VPropertyprotectedarray $_resourceTypes = array()
inherited

Available resource types handled by this resource autoloader

Inherited from: \Zend_Loader_Autoloader_Resource::$$_resourceTypes
Default valuearray()Details
Type
array
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_resourceTypes  

Methods

methodpublic__call(string $method, array $args) : mixed
inherited

Overloading: methods

Inherited from: \Zend_Loader_Autoloader_Resource::__call()

Allow retrieving concrete resource object instances using 'get()' syntax. Example:

$loader = new Zend_Loader_Autoloader_Resource(array(
    'namespace' => 'Stuff_',
    'basePath'  => '/path/to/some/stuff',
))
$loader->addResourceType('Model', 'models', 'Model');

$foo = $loader->getModel('Foo'); // get instance of Stuff_Model_Foo class
Parameters
NameTypeDescription
$methodstring
$argsarray
Returns
TypeDescription
mixed
Throws
ExceptionDescription
\Zend_Loader_Exceptionif method not beginning with 'get' or not matching a valid resource type is called
methodpublic__construct(array | \Zend_Config $options) : void

Constructor

Parameters
NameTypeDescription
$optionsarray | \Zend_Config
methodpublicaddResourceType(string $type, string $path, null | string $namespace = null) : \Zend_Loader_Autoloader_Resource
inherited

Add resource type

Inherited from: \Zend_Loader_Autoloader_Resource::addResourceType()
Parameters
NameTypeDescription
$typestring

identifier for the resource type being loaded

$pathstring

path relative to resource base path containing the resource types

$namespacenull | string

sub-component namespace to append to base namespace that qualifies this resource type

Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicaddResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
inherited

Add multiple resources at once

Inherited from: \Zend_Loader_Autoloader_Resource::addResourceTypes()

$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
NameTypeDescription
$typesarray
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicautoload(string $class) : mixed
inherited

Attempt to autoload a class

Inherited from: \Zend_Loader_Autoloader_Resource::autoload()
Parameters
NameTypeDescription
$classstring
Returns
TypeDescription
mixedFalse if not matched, otherwise result if include operation
methodpublicclearResourceTypes() : \Zend_Loader_Autoloader_Resource
inherited

Clear all resource types

Inherited from: \Zend_Loader_Autoloader_Resource::clearResourceTypes()
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicgetBasePath() : string
inherited

Get base path to this set of resources

Inherited from: \Zend_Loader_Autoloader_Resource::getBasePath()
Returns
TypeDescription
string
methodpublicgetClassPath(string $class) : False
inherited

Helper method to calculate the correct class path

Inherited from: \Zend_Loader_Autoloader_Resource::getClassPath()
Parameters
NameTypeDescription
$classstring
Returns
TypeDescription
Falseif not matched other wise the correct path
methodpublicgetDefaultResourceType() : string | null
inherited

Get default resource type to use when calling load()

Inherited from: \Zend_Loader_Autoloader_Resource::getDefaultResourceType()
Returns
TypeDescription
string | null
methodpublicgetNamespace() : string
inherited

Get namespace this autoloader handles

Inherited from: \Zend_Loader_Autoloader_Resource::getNamespace()
Returns
TypeDescription
string
methodpublicgetResourceTypes() : array
inherited

Retrieve resource type mappings

Inherited from: \Zend_Loader_Autoloader_Resource::getResourceTypes()
Returns
TypeDescription
array
methodpublichasResourceType(string $type) : bool
inherited

Is the requested resource type defined?

Inherited from: \Zend_Loader_Autoloader_Resource::hasResourceType()
Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
bool
methodpublicinitDefaultResourceTypes() : void

Initialize default resource types for module resource classes

methodpublicload(string $resource, string $type = null) : object
inherited

Object registry and factory

Inherited from: \Zend_Loader_Autoloader_Resource::load()

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
NameTypeDescription
$resourcestring
$typestring
Returns
TypeDescription
object
Throws
ExceptionDescription
\Zend_Loader_Exceptionif resource type not specified or invalid
methodpublicremoveResourceType(string $type) : \Zend_Loader_Autoloader_Resource
inherited

Remove the requested resource type

Inherited from: \Zend_Loader_Autoloader_Resource::removeResourceType()
Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicsetBasePath(string $path) : \Zend_Loader_Autoloader_Resource
inherited

Set base path for this set of resources

Inherited from: \Zend_Loader_Autoloader_Resource::setBasePath()
Parameters
NameTypeDescription
$pathstring
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicsetDefaultResourceType(string $type) : \Zend_Loader_Autoloader_Resource
inherited

Set default resource type to use when calling load()

Inherited from: \Zend_Loader_Autoloader_Resource::setDefaultResourceType()
Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicsetNamespace(string $namespace) : \Zend_Loader_Autoloader_Resource
inherited

Set namespace that this autoloader handles

Inherited from: \Zend_Loader_Autoloader_Resource::setNamespace()
Parameters
NameTypeDescription
$namespacestring
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicsetOptions(array $options) : \Zend_Loader_Autoloader_Resource
inherited

Set class state from options

Inherited from: \Zend_Loader_Autoloader_Resource::setOptions()
Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
methodpublicsetResourceTypes(array $types) : \Zend_Loader_Autoloader_Resource
inherited

Overwrite existing and set multiple resource types at once

Inherited from: \Zend_Loader_Autoloader_Resource::setResourceTypes()
Parameters
NameTypeDescription
$typesarray
Returns
TypeDescription
\Zend_Loader_Autoloader_Resource
Details
See
\Zend_Loader_Autoloader_Resource::addResourceTypes()  
Documentation was generated by phpDocumentor 2.0.0a12.