Application/Module/Autoloader.php

Show: inherited
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 [email protected] 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

Propertyprotectedstring $_basePath =
inherited

<p>Base path to resource classes</p>Inherited from: \Zend_Loader_Autoloader_Resource::$$_basePath
Details
Type
string
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_basePath  
Propertyprotectedarray $_components = array()
inherited

<p>Components handled within this resource</p>Inherited from: \Zend_Loader_Autoloader_Resource::$$_components
Default valuearray()Details
Type
array
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_components  
Propertyprotectedstring $_defaultResourceType =
inherited

<p>Default resource/component to use when using object registry</p> Inherited from: \Zend_Loader_Autoloader_Resource::$$_defaultResourceType
Details
Type
string
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_defaultResourceType  
Propertyprotectedstring $_namespace =
inherited

<p>Namespace of classes within this resource</p>Inherited from: \Zend_Loader_Autoloader_Resource::$$_namespace
Details
Type
string
Inherited_from
\Zend_Loader_Autoloader_Resource::$$_namespace  
Propertyprotectedarray $_resourceTypes = array()
inherited

<p>Available resource types handled by this resource autoloader</p>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
Name Type Description
$method string
$args array
Returns
Type Description
mixed
Throws
Exception Description
\Zend_Loader_Exception if method not beginning with 'get' or not matching a valid resource type is called
methodpublic__construct(array | \Zend_Config $options) : void

Constructor

Parameters
Name Type Description
$options array | \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
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
Type Description
\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
Name Type Description
$types array
Returns
Type Description
\Zend_Loader_Autoloader_Resource
methodpublicautoload(string $class) : mixed
inherited

Attempt to autoload a class

Inherited from: \Zend_Loader_Autoloader_Resource::autoload()
Parameters
Name Type Description
$class string
Returns
Type Description
mixed False 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
Type Description
\Zend_Loader_Autoloader_Resource
methodpublicgetBasePath() : string
inherited

Get base path to this set of resources

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

Helper method to calculate the correct class path

Inherited from: \Zend_Loader_Autoloader_Resource::getClassPath()
Parameters
Name Type Description
$class string
Returns
Type Description
False if 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
Type Description
string | null
methodpublicgetNamespace() : string
inherited

Get namespace this autoloader handles

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

Retrieve resource type mappings

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

Is the requested resource type defined?

Inherited from: \Zend_Loader_Autoloader_Resource::hasResourceType()
Parameters
Name Type Description
$type string
Returns
Type Description
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
Name Type Description
$resource string
$type string
Returns
Type Description
object
Throws
Exception Description
\Zend_Loader_Exception if 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
Name Type Description
$type string
Returns
Type Description
\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
Name Type Description
$path string
Returns
Type Description
\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
Name Type Description
$type string
Returns
Type Description
\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
Name Type Description
$namespace string
Returns
Type Description
\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
Name Type Description
$options array
Returns
Type Description
\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
Name Type Description
$types array
Returns
Type Description
\Zend_Loader_Autoloader_Resource
Details
See
\global\Zend_Loader_Autoloader_Resource::addResourceTypes()  
Documentation was generated by phpDocumentor 2.0.0a8.