API Documentation

Loader/Autoloader/Resource.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Loader
subpackage
Autoloader
version
$Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Loader_Autoloader_Resource

Description

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.

Zend_Loader_Autoloader_Resource

Implements
Zend_Loader_Autoloader_Interface
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Loader
subpackage
Autoloader
uses
Zend_Loader_Autoloader_Interface
Properties
$_basePath
$_components
$_defaultResourceType
$_namespace
$_resourceTypes
Methods
__construct
__call
getClassPath
autoload
setOptions
setNamespace
getNamespace
setBasePath
getBasePath
addResourceType
addResourceTypes
setResourceTypes
getResourceTypes
hasResourceType
removeResourceType
clearResourceTypes
setDefaultResourceType
getDefaultResourceType
load

Description

Resource loader

Properties

$_basePath

string $_basePath = ''

Details

$_basePath
string
Base path to resource classes
visibility
protected
default
final
false
static
false

$_components

array $_components = 'array'

Details

$_components
array
Components handled within this resource
visibility
protected
default
array
final
false
static
false

$_defaultResourceType

string $_defaultResourceType = ''

Details

$_defaultResourceType
string
Default resource/component to use when using object registry
visibility
protected
default
final
false
static
false

$_namespace

string $_namespace = ''

Details

$_namespace
string
Namespace of classes within this resource
visibility
protected
default
final
false
static
false

$_resourceTypes

array $_resourceTypes = 'array'

Details

$_resourceTypes
array
Available resource types handled by this resource autoloader
visibility
protected
default
array
final
false
static
false

Methods

__call

__call( string $method, array $args ) : mixed

Overloading: methods

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

Arguments
$method
string
$args
array
Output
mixed
Details
visibility
public
final
false
static
false
throws
if method not beginning with 'get' or not matching a valid resource type is called

__construct

__construct( array|Zend_Config $options ) : void

Constructor

Arguments
$options
arrayZend_Config
Configuration options for resource autoloader
Details
visibility
public
final
false
static
false

addResourceType

addResourceType( string $type, string $path, null|string $namespace = null ) : Zend_Loader_Autoloader_Resource

Add resource type

Arguments
$type
string
identifier for the resource type being loaded
$path
string
path relative to resource base path containing the resource types
$namespace
nullstring
sub-component namespace to append to base namespace that qualifies this resource type
Details
visibility
public
final
false
static
false

addResourceTypes

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', ), ));

Arguments
$types
array
Details
visibility
public
final
false
static
false

autoload

autoload( string $class ) : mixed

Attempt to autoload a class

Arguments
$class
string
Output
mixed
False if not matched, otherwise result if include operation
Details
visibility
public
final
false
static
false

clearResourceTypes

clearResourceTypes( ) : Zend_Loader_Autoloader_Resource

Clear all resource types

Details
visibility
public
final
false
static
false

getBasePath

getBasePath( ) : string

Get base path to this set of resources

Output
string
Details
visibility
public
final
false
static
false

getClassPath

getClassPath( string $class ) : False

Helper method to calculate the correct class path

Arguments
$class
string
Output
False
if not matched other wise the correct path
Details
visibility
public
final
false
static
false

getDefaultResourceType

getDefaultResourceType( ) : string|null

Get default resource type to use when calling load()

Output
string|null
Details
visibility
public
final
false
static
false

getNamespace

getNamespace( ) : string

Get namespace this autoloader handles

Output
string
Details
visibility
public
final
false
static
false

getResourceTypes

getResourceTypes( ) : array

Retrieve resource type mappings

Output
array
Details
visibility
public
final
false
static
false

hasResourceType

hasResourceType( string $type ) : bool

Is the requested resource type defined?

Arguments
$type
string
Output
bool
Details
visibility
public
final
false
static
false

load

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.

Arguments
$resource
string
$type
string
Output
object
Details
visibility
public
final
false
static
false
throws
if resource type not specified or invalid

removeResourceType

removeResourceType( string $type ) : Zend_Loader_Autoloader_Resource

Remove the requested resource type

Arguments
$type
string
Details
visibility
public
final
false
static
false

setBasePath

setBasePath( string $path ) : Zend_Loader_Autoloader_Resource

Set base path for this set of resources

Arguments
$path
string
Details
visibility
public
final
false
static
false

setDefaultResourceType

setDefaultResourceType( string $type ) : Zend_Loader_Autoloader_Resource

Set default resource type to use when calling load()

Arguments
$type
string
Details
visibility
public
final
false
static
false

setNamespace

setNamespace( string $namespace ) : Zend_Loader_Autoloader_Resource

Set namespace that this autoloader handles

Arguments
$namespace
string
Details
visibility
public
final
false
static
false

setOptions

setOptions( array $options ) : Zend_Loader_Autoloader_Resource

Set class state from options

Arguments
$options
array
Details
visibility
public
final
false
static
false

setResourceTypes

setResourceTypes( array $types ) : Zend_Loader_Autoloader_Resource

Overwrite existing and set multiple resource types at once

Arguments
$types
array
Details
visibility
public
final
false
static
false
see
Zend_Loader_Autoloader_Resource::addResourceTypes()
Documentation was generated by DocBlox.