Zend Framework  1.12
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_Application_Bootstrap_BootstrapAbstract Class Reference

Public Member Functions

 __construct ($application)
 Constructor.
 
 setOptions (array $options)
 Set class state.
 
 getOptions ()
 Get current options from bootstrap.
 
 hasOption ($key)
 Is an option present?
 
 getOption ($key)
 Retrieve a single option.
 
 mergeOptions (array $array1, $array2=null)
 Merge options recursively.
 
 getClassResources ()
 Get class resources (as resource/method pairs)
 
 getClassResourceNames ()
 Get class resource names.
 
 registerPluginResource ($resource, $options=null)
 Register a new resource plugin.
 
 unregisterPluginResource ($resource)
 Unregister a resource from the bootstrap.
 
 hasPluginResource ($resource)
 Is the requested plugin resource registered?
 
 getPluginResource ($resource)
 Get a registered plugin resource.
 
 getPluginResources ()
 Retrieve all plugin resources.
 
 getPluginResourceNames ()
 Retrieve plugin resource names.
 
 setPluginLoader (Zend_Loader_PluginLoader_Interface $loader)
 Set plugin loader for loading resources.
 
 getPluginLoader ()
 Get the plugin loader for resources.
 
 setApplication ($application)
 Set application/parent bootstrap.
 
 getApplication ()
 Retrieve parent application instance.
 
 getEnvironment ()
 Retrieve application environment.
 
 setContainer ($container)
 Set resource container.
 
 getContainer ()
 Retrieve resource container.
 
 hasResource ($name)
 Determine if a resource has been stored in the container.
 
 getResource ($name)
 Retrieve a resource from the container.
 
 __get ($prop)
 Implement PHP's magic to retrieve a ressource in the bootstrap.
 
 __isset ($prop)
 Implement PHP's magic to ask for the existence of a ressource in the bootstrap.
 
 bootstrap ($resource=null)
 Bootstrap individual, all, or multiple resources.
 
 __call ($method, $args)
 Overloading: intercept calls to bootstrap<resourcename>() methods.
 
- Public Member Functions inherited from Zend_Application_Bootstrap_Bootstrapper
 run ()
 Run the application.
 

Protected Member Functions

 _bootstrap ($resource=null)
 Bootstrap implementation.
 
 _executeResource ($resource)
 Execute a resource.
 
 _loadPluginResource ($resource, $options)
 Load a plugin resource.
 
 _markRun ($resource)
 Mark a resource as having run.
 
 _resolvePluginResourceName ($resource)
 Resolve a plugin resource name.
 

Protected Attributes

 $_application
 
 $_classResources
 
 $_container
 
 $_environment
 
 $_optionKeys = array()
 
 $_options = array()
 
 $_pluginLoader
 
 $_pluginResources = array()
 
 $_run = array()
 
 $_started = array()
 

Constructor & Destructor Documentation

__construct (   $application)

Constructor.

Sets application object, initializes options, and prepares list of initializer methods.

Parameters
Zend_Application | Zend_Application_Bootstrap_Bootstrapper$application
Returns
void
Exceptions
Zend_Application_Bootstrap_ExceptionWhen invalid application is provided

Implements Zend_Application_Bootstrap_Bootstrapper.

Member Function Documentation

__call (   $method,
  $args 
)

Overloading: intercept calls to bootstrap<resourcename>() methods.

Parameters
string$method
array$args
Returns
void
Exceptions
Zend_Application_Bootstrap_ExceptionOn invalid method name
__get (   $prop)

Implement PHP's magic to retrieve a ressource in the bootstrap.

Parameters
string$prop
Returns
null|mixed
__isset (   $prop)

Implement PHP's magic to ask for the existence of a ressource in the bootstrap.

Parameters
string$prop
Returns
bool
_bootstrap (   $resource = null)
protected

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
Exceptions
Zend_Application_Bootstrap_ExceptionWhen invalid argument was passed
_executeResource (   $resource)
protected

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
Exceptions
Zend_Application_Bootstrap_ExceptionWhen resource not found
_loadPluginResource (   $resource,
  $options 
)
protected

Load a plugin resource.

Parameters
string$resource
array | object | null$options
Returns
string|false
_markRun (   $resource)
protected

Mark a resource as having run.

Parameters
string$resource
Returns
void
_resolvePluginResourceName (   $resource)
protected

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 (   $resource = null)
final

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
Returns
Zend_Application_Bootstrap_BootstrapAbstract
Exceptions
Zend_Application_Bootstrap_ExceptionWhen invalid argument was passed

Implements Zend_Application_Bootstrap_Bootstrapper.

getApplication ( )

Retrieve parent application instance.

Returns
Zend_Application|Zend_Application_Bootstrap_Bootstrapper

Implements Zend_Application_Bootstrap_Bootstrapper.

getClassResourceNames ( )

Get class resource names.

Returns
array

Implements Zend_Application_Bootstrap_Bootstrapper.

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

Implements Zend_Application_Bootstrap_Bootstrapper.

getContainer ( )

Retrieve resource container.

Returns
object
getEnvironment ( )

Retrieve application environment.

Returns
string

Implements Zend_Application_Bootstrap_Bootstrapper.

getOption (   $key)

Retrieve a single option.

Parameters
string$key
Returns
mixed
getOptions ( )

Get current options from bootstrap.

Returns
array
getPluginLoader ( )

Get the plugin loader for resources.

Returns
Zend_Loader_PluginLoader_Interface

Implements Zend_Application_Bootstrap_ResourceBootstrapper.

getPluginResource (   $resource)

Get a registered plugin resource.

Parameters
string$resourceName
Returns
Zend_Application_Resource_Resource

Implements Zend_Application_Bootstrap_ResourceBootstrapper.

getPluginResourceNames ( )

Retrieve plugin resource names.

Returns
array

Implements Zend_Application_Bootstrap_ResourceBootstrapper.

getPluginResources ( )

Retrieve all plugin resources.

Returns
array

Implements Zend_Application_Bootstrap_ResourceBootstrapper.

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 (   $key)

Is an option present?

Parameters
string$key
Returns
bool
hasPluginResource (   $resource)

Is the requested plugin resource registered?

Parameters
string$resource
Returns
bool

Implements Zend_Application_Bootstrap_ResourceBootstrapper.

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 ( array  $array1,
  $array2 = null 
)

Merge options recursively.

Parameters
array$array1
mixed$array2
Returns
array
registerPluginResource (   $resource,
  $options = null 
)

Register a new resource plugin.

Parameters
string | Zend_Application_Resource_Resource$resource
mixed$options
Returns
Zend_Application_Bootstrap_BootstrapAbstract
Exceptions
Zend_Application_Bootstrap_ExceptionWhen invalid resource is provided

Implements Zend_Application_Bootstrap_ResourceBootstrapper.

setApplication (   $application)

Set application/parent bootstrap.

Parameters
Zend_Application | Zend_Application_Bootstrap_Bootstrapper$application
Returns
Zend_Application_Bootstrap_BootstrapAbstract
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
Returns
Zend_Application_Bootstrap_BootstrapAbstract
setOptions ( array  $options)

Set class state.

Parameters
array$options
Returns
Zend_Application_Bootstrap_BootstrapAbstract

Implements Zend_Application_Bootstrap_Bootstrapper.

setPluginLoader ( Zend_Loader_PluginLoader_Interface  $loader)
unregisterPluginResource (   $resource)

Unregister a resource from the bootstrap.

Parameters
string | Zend_Application_Resource_Resource$resource
Returns
Zend_Application_Bootstrap_BootstrapAbstract
Exceptions
Zend_Application_Bootstrap_ExceptionWhen unknown resource type is provided

Implements Zend_Application_Bootstrap_ResourceBootstrapper.

Member Data Documentation

$_application
protected
$_classResources
protected
$_container
protected
$_environment
protected
$_optionKeys = array()
protected
$_options = array()
protected
$_pluginLoader
protected
$_pluginResources = array()
protected
$_run = array()
protected
$_started = array()
protected