Inheritances
Files
Overview
FRAMES
NO FRAMES

Abstract class Zend_Application_Bootstrap_BootstrapAbstract

Abstract base class for bootstrap classes
UsesZend_Application_Bootstrap_Bootstrapper
UsesZend_Application_Bootstrap_ResourceBootstrapper
CategoryZend
PackageZend_Application
SubpackageBootstrap
CopyrightCopyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
Licensehttp://framework.zend.com/license/new-bsd New BSD License

Summary

Instance fields
# $_application
# $_classResources
# $_container
# $_environment
# $_optionKeys Flattened (lowercase) option keys used for lookups
# $_options
# $_pluginLoader
# $_pluginResources
# $_run
# $_started
Instance methods
+ __call() Overloading: intercept calls to bootstrap() methods
+ __construct() Constructor
+ __get() Implement PHP's magic to retrieve a ressource
+ __isset() Implement PHP's magic to ask for the
# _bootstrap() Bootstrap implementation
# _executeResource() Execute a resource
# _loadPluginResource() Load a plugin resource
# _markRun() Mark a resource as having run
# _resolvePluginResourceName() Resolve a plugin resource name
+ bootstrap() Bootstrap individual, all, or multiple resources
+ getApplication() Retrieve parent application instance
+ getClassResourceNames() Get class resource names
+ getClassResources() Get class resources (as resource/method pairs)
+ getContainer() Retrieve resource container
+ getEnvironment() Retrieve application environment
+ getOption() Retrieve a single option
+ getOptions() Get current options from bootstrap
+ getPluginLoader() Get the plugin loader for resources
+ getPluginResource() Get a registered plugin resource
+ getPluginResourceNames() Retrieve plugin resource names
+ getPluginResources() Retrieve all plugin resources
+ getResource() Retrieve a resource from the container
+ hasOption() Is an option present?
+ hasPluginResource() Is the requested plugin resource registered?
+ hasResource() Determine if a resource has been stored in the container
+ mergeOptions() Merge options recursively
+ registerPluginResource() Register a new resource plugin
+ setApplication() Set application/parent bootstrap
+ setContainer() Set resource container
+ setOptions() Set class state
+ setPluginLoader() Set plugin loader for loading resources
+ unregisterPluginResource() Unregister a resource from the bootstrap

Details

Instance fields

$_classResources
protected $_classResources
Var array Internal resource methods (resource/method pairs)
$_container
protected $_container
Var object Resource container
$_environment
protected $_environment
Var string
$_optionKeys
protected $_optionKeys = array()
Flattened (lowercase) option keys used for lookups
Var array
$_options
protected $_options = array()
Var array
$_pluginResources
protected $_pluginResources = array()
Var array Class-based resource plugins
$_run
protected $_run = array()
Var array Initializers that have been run
$_started
protected $_started = array()
Var array Initializers that have been started but not yet completed (circular dependency detection)

Instance methods

__call()
public function __call( $method
$args
)
Overloading: intercept calls to bootstrap() methods
Parameters
string $method
array $args
Returns void
Throws Zend_Application_Bootstrap_Exception On invalid method name
__construct()
public function __construct( $application)
Constructor

Sets application object, initializes options, and prepares list of
initializer methods.
Parameters
Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application
Returns void
Throws Zend_Application_Bootstrap_Exception When invalid applicaiton is provided
Overriden by __construct() in class : Zend_Application_Bootstrap_Bootstrap
__get()
public function __get( $prop)
Implement PHP's magic to retrieve a ressource
in the bootstrap
Parameters
string $prop
Returns null|mixed
__isset()
public function __isset( $prop)
Implement PHP's magic to ask for the
existence of a ressource in the bootstrap
Parameters
string $prop
Returns bool
_bootstrap()
protected function _bootstrap( $resource = null)
Bootstrap implementation

This method may be overridden to provide custom bootstrapping logic.
It is the sole method called by bootstrap().
Parameters
null|string|array $resource
Returns void
Throws Zend_Application_Bootstrap_Exception When invalid argument was passed
_executeResource()
protected function _executeResource( $resource)
Execute a resource

Checks to see if the resource has already been run. If not, it searches
first to see if a local method matches the resource, and executes that.
If not, it checks to see if a plugin resource matches, and executes that
if found.

Finally, if not found, it throws an exception.
Parameters
string $resource
Returns void
Throws Zend_Application_Bootstrap_Exception When resource not found
_loadPluginResource()
protected function _loadPluginResource( $resource
$options
)
Load a plugin resource
Parameters
string $resource
array|object|null $options
Returns string|false
_markRun()
protected function _markRun( $resource)
Mark a resource as having run
Parameters
string $resource
Returns void
_resolvePluginResourceName()
protected function _resolvePluginResourceName( $resource)
Resolve a plugin resource name

Uses, in order of preference
- $_explicitType property of resource
- Short name of resource (if a matching prefix path is found)
- class name (if none of the above are true)

The name is then cast to lowercase.
Parameters
Zend_Application_Resource_Resource $resource
Returns string
bootstrap()
final public function bootstrap( $resource = null)
Bootstrap individual, all, or multiple resources

Marked as final to prevent issues when subclassing and naming the
child class 'Bootstrap' (in which case, overriding this method
would result in it being treated as a constructor).

If you need to override this functionality, override the
_bootstrap() method.
Parameters
null|string|array $resource
Throws Zend_Application_Bootstrap_Exception When invalid argument was passed
getApplication()
public function getApplication( )
Retrieve parent application instance
getClassResourceNames()
public function getClassResourceNames( )
Get class resource names
Returns array
getClassResources()
public function getClassResources( )
Get class resources (as resource/method pairs)

Uses get_class_methods() by default, reflection on prior to 5.2.6,
as a bug prevents the usage of get_class_methods() there.
Returns array
getContainer()
public function getContainer( )
Retrieve resource container
Returns object
getEnvironment()
public function getEnvironment( )
Retrieve application environment
Returns string
getOption()
public function getOption( $key)
Retrieve a single option
Parameters
string $key
Returns mixed
getOptions()
public function getOptions( )
Get current options from bootstrap
Returns array
getPluginLoader()
public function getPluginLoader( )
Get the plugin loader for resources
getPluginResource()
public function getPluginResource( $resource)
Get a registered plugin resource
Parameters
$resource
getPluginResourceNames()
public function getPluginResourceNames( )
Retrieve plugin resource names
Returns array
getPluginResources()
public function getPluginResources( )
Retrieve all plugin resources
Returns array
getResource()
public function getResource( $name)
Retrieve a resource from the container

During bootstrap resource initialization, you may return a value. If
you do, it will be stored in the container.
You can use this method to retrieve that value.

If no value was returned, this will return a null value.
Parameters
string $name
Returns null|mixed
hasOption()
public function hasOption( $key)
Is an option present?
Parameters
string $key
Returns bool
hasPluginResource()
public function hasPluginResource( $resource)
Is the requested plugin resource registered?
Parameters
string $resource
Returns bool
hasResource()
public function hasResource( $name)
Determine if a resource has been stored in the container

During bootstrap resource initialization, you may return a value. If
you do, it will be stored in the container.
You can use this method to determine if a value was stored.
Parameters
string $name
Returns bool
mergeOptions()
public function mergeOptions( array $array1
$array2 = null
)
Merge options recursively
Parameters
array $array1
mixed $array2
Returns array
registerPluginResource()
public function registerPluginResource( $resource
$options = null
)
Register a new resource plugin
Parameters
string|Zend_Application_Resource_Resource $resource
mixed $options
Throws Zend_Application_Bootstrap_Exception When invalid resource is provided
setApplication()
public function setApplication( $application)
Set application/parent bootstrap
Parameters
Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application
setContainer()
public function setContainer( $container)
Set resource container

By default, if a resource callback has a non-null return value, this
value will be stored in a container using the resource name as the
key.

Containers must be objects, and must allow setting public properties.
Parameters
object $container
setOptions()
public function setOptions( array $options)
Set class state
Parameters
array $options
setPluginLoader()
public function setPluginLoader( Zend_Loader_PluginLoader_Interface $loader)
Set plugin loader for loading resources
Parameters
Zend_Loader_PluginLoader_Interface $loader
unregisterPluginResource()
public function unregisterPluginResource( $resource)
Unregister a resource from the bootstrap
Parameters
string|Zend_Application_Resource_Resource $resource
Throws Zend_Application_Bootstrap_Exception When unknown resource type is provided