[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Loader/Autoloader/ -> Resource.php (summary)

Zend Framework LICENSE

Copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
License: http://framework.zend.com/license/new-bsd New BSD License
Version: $Id$
File Size: 460 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Zend_Loader_Autoloader_Resource:: (19 methods):
  __construct()
  __call()
  getClassPath()
  autoload()
  setOptions()
  setNamespace()
  getNamespace()
  setBasePath()
  getBasePath()
  addResourceType()
  addResourceTypes()
  setResourceTypes()
  getResourceTypes()
  hasResourceType()
  removeResourceType()
  clearResourceTypes()
  setDefaultResourceType()
  getDefaultResourceType()
  load()


Class: Zend_Loader_Autoloader_Resource  - X-Ref

Resource loader

__construct($options)   X-Ref
Constructor

param: array|Zend_Config $options Configuration options for resource autoloader
return: void

__call($method, $args)   X-Ref
Overloading: methods

Allow retrieving concrete resource object instances using 'get<Resourcename>()'
syntax. Example:
<code>
$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
</code>

param: string $method
param: array $args
return: mixed

getClassPath($class)   X-Ref
Helper method to calculate the correct class path

param: string $class
return: False if not matched other wise the correct path

autoload($class)   X-Ref
Attempt to autoload a class

param: string $class
return: mixed False if not matched, otherwise result if include operation

setOptions(array $options)   X-Ref
Set class state from options

param: array $options
return: Zend_Loader_Autoloader_Resource

setNamespace($namespace)   X-Ref
Set namespace that this autoloader handles

param: string $namespace
return: Zend_Loader_Autoloader_Resource

getNamespace()   X-Ref
Get namespace this autoloader handles

return: string

setBasePath($path)   X-Ref
Set base path for this set of resources

param: string $path
return: Zend_Loader_Autoloader_Resource

getBasePath()   X-Ref
Get base path to this set of resources

return: string

addResourceType($type, $path, $namespace = null)   X-Ref
Add resource type

param: string $type identifier for the resource type being loaded
param: string $path path relative to resource base path containing the resource types
param: null|string $namespace sub-component namespace to append to base namespace that qualifies this resource type
return: Zend_Loader_Autoloader_Resource

addResourceTypes(array $types)   X-Ref
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:
<code>
$loader->addResourceTypes(array(
'model' => array(
'path'      => 'models',
'namespace' => 'Model',
),
'form' => array(
'path'      => 'forms',
'namespace' => 'Form',
),
));
</code>

param: array $types
return: Zend_Loader_Autoloader_Resource

setResourceTypes(array $types)   X-Ref
Overwrite existing and set multiple resource types at once

param: array $types
return: Zend_Loader_Autoloader_Resource

getResourceTypes()   X-Ref
Retrieve resource type mappings

return: array

hasResourceType($type)   X-Ref
Is the requested resource type defined?

param: string $type
return: bool

removeResourceType($type)   X-Ref
Remove the requested resource type

param: string $type
return: Zend_Loader_Autoloader_Resource

clearResourceTypes()   X-Ref
Clear all resource types

return: Zend_Loader_Autoloader_Resource

setDefaultResourceType($type)   X-Ref
Set default resource type to use when calling load()

param: string $type
return: Zend_Loader_Autoloader_Resource

getDefaultResourceType()   X-Ref
Get default resource type to use when calling load()

return: string|null

load($resource, $type = null)   X-Ref
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.

param: string $resource
param: string $type
return: object



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1