Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
    • REST
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Db
      • Adapter
      • Expr
      • Profiler
      • Select
      • Statement
      • Table
    • Loader
      • Autoloader
      • PluginLoader
    • Registry

Classes

  • Zend_Loader_Autoloader
  • Zend_Loader_Autoloader_Resource

Interfaces

  • Zend_Loader_Autoloader_Interface
  • Overview
  • Package
  • Class
  • Tree

Class Zend_Loader_Autoloader_Resource

Resource loader

Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interface
Package: Zend\Loader\Autoloader
Copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
License: New BSD License
Uses: Zend_Loader_Autoloader_Interface
Located at Zend/Loader/Autoloader/Resource.php
Methods summary
public
# __construct( array|Zend_Config $options )

Constructor

Constructor

Parameters

$options
array|Zend_Config
Configuration options for resource autoloader
public mixed
# __call( string $method, array $args )

Overloading: methods

Overloading: methods

Allow retrieving concrete resource object instances using 'get<Resourcename>()' 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

$method
string
$args
array

Returns

mixed

Throws

Zend_Loader_Exception
if method not beginning with 'get' or not matching a valid resource type is called
public False
# getClassPath( string $class )

Helper method to calculate the correct class path

Helper method to calculate the correct class path

Parameters

$class
string

Returns

False
if not matched other wise the correct path
public mixed
# autoload( string $class )

Attempt to autoload a class

Attempt to autoload a class

Parameters

$class
string

Returns

mixed
False if not matched, otherwise result if include operation

Implementation of

Zend_Loader_Autoloader_Interface::autoload
public Zend_Loader_Autoloader_Resource
# setOptions( array $options )

Set class state from options

Set class state from options

Parameters

$options
array

Returns

Zend_Loader_Autoloader_Resource
public Zend_Loader_Autoloader_Resource
# setNamespace( string $namespace )

Set namespace that this autoloader handles

Set namespace that this autoloader handles

Parameters

$namespace
string

Returns

Zend_Loader_Autoloader_Resource
public string
# getNamespace( )

Get namespace this autoloader handles

Get namespace this autoloader handles

Returns

string
public Zend_Loader_Autoloader_Resource
# setBasePath( string $path )

Set base path for this set of resources

Set base path for this set of resources

Parameters

$path
string

Returns

Zend_Loader_Autoloader_Resource
public string
# getBasePath( )

Get base path to this set of resources

Get base path to this set of resources

Returns

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

Add resource type

Add resource type

Parameters

$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

Zend_Loader_Autoloader_Resource
public Zend_Loader_Autoloader_Resource
# addResourceTypes( array $types )

Add multiple resources at once

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

Parameters

$types
array

Returns

Zend_Loader_Autoloader_Resource
public Zend_Loader_Autoloader_Resource
# setResourceTypes( array $types )

Overwrite existing and set multiple resource types at once

Overwrite existing and set multiple resource types at once

Parameters

$types
array

Returns

Zend_Loader_Autoloader_Resource

See

Zend_Loader_Autoloader_Resource::addResourceTypes()
public array
# getResourceTypes( )

Retrieve resource type mappings

Retrieve resource type mappings

Returns

array
public boolean
# hasResourceType( string $type )

Is the requested resource type defined?

Is the requested resource type defined?

Parameters

$type
string

Returns

boolean
public Zend_Loader_Autoloader_Resource
# removeResourceType( string $type )

Remove the requested resource type

Remove the requested resource type

Parameters

$type
string

Returns

Zend_Loader_Autoloader_Resource
public Zend_Loader_Autoloader_Resource
# clearResourceTypes( )

Clear all resource types

Clear all resource types

Returns

Zend_Loader_Autoloader_Resource
public Zend_Loader_Autoloader_Resource
# setDefaultResourceType( string $type )

Set default resource type to use when calling load()

Set default resource type to use when calling load()

Parameters

$type
string

Returns

Zend_Loader_Autoloader_Resource
public string|null
# getDefaultResourceType( )

Get default resource type to use when calling load()

Get default resource type to use when calling load()

Returns

string|null
public object
# load( string $resource, string $type = null )

Object registry and factory

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.

Parameters

$resource
string
$type
string

Returns

object

Throws

Zend_Loader_Exception
if resource type not specified or invalid
Properties summary
protected string $_basePath
#

Base path to resource classes

Base path to resource classes

protected array $_components array()
#

Components handled within this resource

Components handled within this resource

protected string $_defaultResourceType
#

Default resource/component to use when using object registry

Default resource/component to use when using object registry

protected string $_namespace
#

Namespace of classes within this resource

Namespace of classes within this resource

protected array $_resourceTypes array()
#

Available resource types handled by this resource autoloader

Available resource types handled by this resource autoloader

Pry Framework API documentation generated by ApiGen 2.6.1