Abstract base class for bootstrap classes

uses
uses
category Zend
package Zend_Application
subpackage Bootstrap
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

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

__call(string $method, array $args) : \Zend_Application_Bootstrap_BootstrapAbstract

Parameters

$method

string

$args

array

Exceptions

\Zend_Application_Bootstrap_Exception On invalid method name

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Constructor

__construct(\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $application) 

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

inherited_from \Zend_Application_Bootstrap_Bootstrapper::__construct()

Parameters

$application

\Zend_Application\Zend_Application_Bootstrap_Bootstrapper

Exceptions

\Zend_Application_Bootstrap_Exception When invalid application is provided

Implement PHP's magic to retrieve a resource in the bootstrap

__get(string $prop) : null | mixed

Parameters

$prop

string

Returns

nullmixed

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

__isset(string $prop) : boolean

Parameters

$prop

string

Returns

boolean

Bootstrap individual, all, or multiple resources

bootstrap(null|string|array $resource = null) : \Zend_Application_Bootstrap_BootstrapAbstract

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.

inherited_from \Zend_Application_Bootstrap_Bootstrapper::bootstrap()

Parameters

$resource

nullstringarray

Exceptions

\Zend_Application_Bootstrap_Exception When invalid argument was passed

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Retrieve parent application instance

getApplication() : \Zend_Application | \Zend_Application_Bootstrap_Bootstrapper
inherited_from \Zend_Application_Bootstrap_Bootstrapper::getApplication()

Returns

\Zend_Application\Zend_Application_Bootstrap_Bootstrapper

Get class resource names

getClassResourceNames() : array
inherited_from \Zend_Application_Bootstrap_Bootstrapper::getClassResourceNames()

Returns

array

Get class resources (as resource/method pairs)

getClassResources() : array

Uses get_class_methods() by default, reflection on prior to 5.2.6, as a bug prevents the usage of get_class_methods() there.

inherited_from \Zend_Application_Bootstrap_Bootstrapper::getClassResources()

Returns

array

Retrieve resource container

getContainer() : object

Returns

object

Retrieve application environment

getEnvironment() : string
inherited_from \Zend_Application_Bootstrap_Bootstrapper::getEnvironment()

Returns

string

Retrieve a single option

getOption(string $key) : mixed

Parameters

$key

string

Returns

mixed

Get current options from bootstrap

getOptions() : array

Returns

array

Get the plugin loader for resources

getPluginLoader() : \Zend_Loader_PluginLoader_Interface
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::getPluginLoader()

Returns

\Zend_Loader_PluginLoader_Interface

Get a registered plugin resource

getPluginResource(string $resource) : \Zend_Application_Resource_Resource
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::getPluginResource()

Parameters

$resource

string

Exceptions

\Zend_Application_Bootstrap_Exception

Returns

\Zend_Application_Resource_Resource

Retrieve plugin resource names

getPluginResourceNames() : array
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::getPluginResourceNames()

Returns

array

Retrieve all plugin resources

getPluginResources() : array
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::getPluginResources()

Returns

array

Retrieve a resource from the container

getResource(string $name) : null | mixed

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

If no value was returned, this will return a null value.

Parameters

$name

string

Returns

nullmixed

Is an option present?

hasOption(string $key) : boolean

Parameters

$key

string

Returns

boolean

Is the requested plugin resource registered?

hasPluginResource(string $resource) : boolean
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::hasPluginResource()

Parameters

$resource

string

Returns

boolean

Determine if a resource has been stored in the container

hasResource(string $name) : boolean

During bootstrap resource initialization, you may return a value. If you do, it will be stored in the \setContainer(). You can use this method to determine if a value was stored.

Parameters

$name

string

Returns

boolean

Merge options recursively

mergeOptions(array $array1, mixed $array2 = null) : array

Parameters

$array1

array

$array2

mixed

Returns

array

Register a new resource plugin

registerPluginResource(string|\Zend_Application_Resource_Resource $resource, mixed $options = null) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::registerPluginResource()

Parameters

$resource

string\Zend_Application_Resource_Resource

$options

mixed

Exceptions

\Zend_Application_Bootstrap_Exception When invalid resource is provided

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Set application/parent bootstrap

setApplication(\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $application) : \Zend_Application_Bootstrap_BootstrapAbstract

Parameters

$application

\Zend_Application\Zend_Application_Bootstrap_Bootstrapper

Exceptions

\Zend_Application_Bootstrap_Exception

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Set resource container

setContainer(object $container) : \Zend_Application_Bootstrap_BootstrapAbstract

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

$container

object

Exceptions

\Zend_Application_Bootstrap_Exception

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Set class state

setOptions(array $options) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited_from \Zend_Application_Bootstrap_Bootstrapper::setOptions()

Parameters

$options

array

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Set plugin loader for loading resources

setPluginLoader(\Zend_Loader_PluginLoader_Interface $loader) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::setPluginLoader()

Parameters

$loader

\Zend_Loader_PluginLoader_Interface

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Unregister a resource from the bootstrap

unregisterPluginResource(string|\Zend_Application_Resource_Resource $resource) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited_from \Zend_Application_Bootstrap_ResourceBootstrapper::unregisterPluginResource()

Parameters

$resource

string\Zend_Application_Resource_Resource

Exceptions

\Zend_Application_Bootstrap_Exception When unknown resource type is provided

Returns

\Zend_Application_Bootstrap_BootstrapAbstract

Bootstrap implementation

_bootstrap(null|string|array $resource = null) : void

This method may be overridden to provide custom bootstrapping logic. It is the sole method called by \bootstrap().

Parameters

$resource

nullstringarray

Exceptions

\Zend_Application_Bootstrap_Exception When invalid argument was passed

Execute a resource

_executeResource(string $resource) : void

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

$resource

string

Exceptions

\Zend_Application_Bootstrap_Exception When resource not found

Load a plugin resource

_loadPluginResource(string $resource, array|object|null $options) : string | false

Parameters

$resource

string

$options

arrayobjectnull

Returns

stringfalse

Mark a resource as having run

_markRun(string $resource) : void

Parameters

$resource

string

Resolve a plugin resource name

_resolvePluginResourceName(\Zend_Application_Resource_Resource $resource) : string

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

$resource

\Zend_Application_Resource_Resource

Returns

string

 Properties

 

$_application

$_application : \Zend_Application | \Zend_Application_Bootstrap_Bootstrapper

Default

 

Internal resource methods (resource/method pairs)

$_classResources : array

Default

 

Resource container

$_container : object

Default

 

$_environment

$_environment : string

Default

 

Flattened (lowercase) option keys used for lookups

$_optionKeys : array

Default

array()
 

$_options

$_options : array

Default

array()
 

$_pluginLoader

$_pluginLoader : \Zend_Loader_PluginLoader_Interface

Default

 

Class-based resource plugins

$_pluginResources : array

Default

array()
 

Initializers that have been run

$_run : array

Default

array()
 

Initializers that have been started but not yet completed (circular dependency detection)

$_started : array

Default

array()