Application/Module/Bootstrap.php
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Application
- Subpackage
- Module
- Version
- $Id: Bootstrap.php 25024 2012-07-30 15:08:15Z rob $
\Zend_Application_Module_Bootstrap
Registers and utilizes Zend_Controller_Front by default.
- Parent(s)
- \Zend_Application_Bootstrap_Bootstrap < \Zend_Application_Bootstrap_BootstrapAbstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
- \global\Zend_Loader_Autoloader_Resource
- Uses
- \global\Zend_Application_Bootstrap_Bootstrap
Properties


false|string $_appNamespace = false
false
Details- Type
- false | string
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_appNamespace


\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $_application


array $_classResources
Internal resource methods (resource/method pairs)
- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_classResources
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_classResources


object $_container
Resource container
- Type
- object
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_container
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_container


string $_environment
- Type
- string
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_environment
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_environment


array $_optionKeys = array()
array()
Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_optionKeys
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_optionKeys


array $_options = array()
array()
Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_options
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_options


\Zend_Loader_PluginLoader_Interface $_pluginLoader


array $_pluginResources = array()
Class-based resource plugins
array()
Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_pluginResources
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_pluginResources


\Zend_Loader_Autoloader_Resource $_resourceLoader


array $_run = array()
Initializers that have been run
array()
Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_run
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_run


array $_started = array()
Initializers that have been started but not yet completed (circular dependency detection)
array()
Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_started
- Inherited_from
- \Zend_Application_Bootstrap_Bootstrap::$$_started
Methods


__call(string $method, array $args) : void
Overloading: intercept calls to bootstrap
Name | Type | Description |
---|---|---|
$method | string | |
$args | array |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception | On invalid method name |


__construct(\Zend_Application | \Zend_Application_Bootstrap_Bootstrapper $application) : void
Constructor
Ensure FrontController resource is registered
Name | Type | Description |
---|---|---|
$application | \Zend_Application | \Zend_Application_Bootstrap_Bootstrapper |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception | When invalid application is provided |


__get(string $prop) : null | mixed
Implement PHP's magic to retrieve a ressource in the bootstrap
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::__get()\Zend_Application_Bootstrap_Bootstrap::__get()Name | Type | Description |
---|---|---|
$prop | string |
Type | Description |
---|---|
null | mixed |


__isset(string $prop) : bool
Implement PHP's magic to ask for the existence of a ressource in the bootstrap
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::__isset()\Zend_Application_Bootstrap_Bootstrap::__isset()Name | Type | Description |
---|---|---|
$prop | string |
Type | Description |
---|---|
bool |


_bootstrap(null | string | array $resource = null) : void
Bootstrap implementation
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_bootstrap()\Zend_Application_Bootstrap_Bootstrap::_bootstrap()This method may be overridden to provide custom bootstrapping logic. It is the sole method called by bootstrap().
Name | Type | Description |
---|---|---|
$resource | null | string | array |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception | When invalid argument was passed |


_executeResource(string $resource) : void
Execute a resource
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_executeResource()\Zend_Application_Bootstrap_Bootstrap::_executeResource()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.
Name | Type | Description |
---|---|---|
$resource | string |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception | When resource not found |


_loadPluginResource(string $resource, array | object | null $options) : string | false
Load a plugin resource
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_loadPluginResource()\Zend_Application_Bootstrap_Bootstrap::_loadPluginResource()Name | Type | Description |
---|---|---|
$resource | string | |
$options | array | object | null |
Type | Description |
---|---|
string | false |


_markRun(string $resource) : void
Mark a resource as having run
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_markRun()\Zend_Application_Bootstrap_Bootstrap::_markRun()Name | Type | Description |
---|---|---|
$resource | string |


_resolvePluginResourceName(\Zend_Application_Resource_Resource $resource) : string
Resolve a plugin resource name
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_resolvePluginResourceName()\Zend_Application_Bootstrap_Bootstrap::_resolvePluginResourceName()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.
Name | Type | Description |
---|---|---|
$resource | \Zend_Application_Resource_Resource |
Type | Description |
---|---|
string |


bootstrap(null | string | array $resource = null) : \Zend_Application_Bootstrap_BootstrapAbstract
Bootstrap individual, all, or multiple resources
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::bootstrap()\Zend_Application_Bootstrap_Bootstrap::bootstrap()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.
Name | Type | Description |
---|---|---|
$resource | null | string | array |
Type | Description |
---|---|
\Zend_Application_Bootstrap_BootstrapAbstract |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception | When invalid argument was passed |


getAppNamespace() : string
Get default application namespace
Proxies to getModuleName(), and returns the current module name
Type | Description |
---|---|
string |


getApplication() : \Zend_Application | \Zend_Application_Bootstrap_Bootstrapper
Retrieve parent application instance
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getApplication()\Zend_Application_Bootstrap_Bootstrap::getApplication()Type | Description |
---|---|
\Zend_Application | \Zend_Application_Bootstrap_Bootstrapper |


getClassResourceNames() : array
Get class resource names
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getClassResourceNames()\Zend_Application_Bootstrap_Bootstrap::getClassResourceNames()Type | Description |
---|---|
array |


getClassResources() : array
Get class resources (as resource/method pairs)
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getClassResources()\Zend_Application_Bootstrap_Bootstrap::getClassResources()Uses get_class_methods() by default, reflection on prior to 5.2.6, as a bug prevents the usage of get_class_methods() there.
Type | Description |
---|---|
array |


getContainer() : object
Retrieve resource container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getContainer()\Zend_Application_Bootstrap_Bootstrap::getContainer()Type | Description |
---|---|
object |


getEnvironment() : string
Retrieve application environment
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getEnvironment()\Zend_Application_Bootstrap_Bootstrap::getEnvironment()Type | Description |
---|---|
string |


getOption(string $key) : mixed
Retrieve a single option
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getOption()\Zend_Application_Bootstrap_Bootstrap::getOption()Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
mixed |


getOptions() : array
Get current options from bootstrap
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getOptions()\Zend_Application_Bootstrap_Bootstrap::getOptions()Type | Description |
---|---|
array |


getPluginLoader() : \Zend_Loader_PluginLoader_Interface
Get the plugin loader for resources
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginLoader()\Zend_Application_Bootstrap_Bootstrap::getPluginLoader()Type | Description |
---|---|
\Zend_Loader_PluginLoader_Interface |


getPluginResource( $resource) : \Zend_Application_Resource_Resource
Get a registered plugin resource
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginResource()\Zend_Application_Bootstrap_Bootstrap::getPluginResource()Name | Type | Description |
---|---|---|
$resource |
Type | Description |
---|---|
\Zend_Application_Resource_Resource |


getPluginResourceNames() : array
Retrieve plugin resource names
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginResourceNames()\Zend_Application_Bootstrap_Bootstrap::getPluginResourceNames()Type | Description |
---|---|
array |


getPluginResources() : array
Retrieve all plugin resources
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginResources()\Zend_Application_Bootstrap_Bootstrap::getPluginResources()Type | Description |
---|---|
array |


getResource(string $name) : null | mixed
Retrieve a resource from the container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getResource()\Zend_Application_Bootstrap_Bootstrap::getResource()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.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
null | mixed |


getResourceLoader() : \Zend_Loader_Autoloader_Resource
Retrieve module resource loader
Inherited from: \Zend_Application_Bootstrap_Bootstrap::getResourceLoader()Type | Description |
---|---|
\Zend_Loader_Autoloader_Resource |


hasOption(string $key) : bool
Is an option present?
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::hasOption()\Zend_Application_Bootstrap_Bootstrap::hasOption()Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
bool |


hasPluginResource(string $resource) : bool
Is the requested plugin resource registered?
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::hasPluginResource()\Zend_Application_Bootstrap_Bootstrap::hasPluginResource()Name | Type | Description |
---|---|---|
$resource | string |
Type | Description |
---|---|
bool |


hasResource(string $name) : bool
Determine if a resource has been stored in the container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::hasResource()\Zend_Application_Bootstrap_Bootstrap::hasResource()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.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
bool |


mergeOptions(array $array1, mixed $array2 = null) : array
Merge options recursively
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::mergeOptions()\Zend_Application_Bootstrap_Bootstrap::mergeOptions()Name | Type | Description |
---|---|---|
$array1 | array | |
$array2 | mixed |
Type | Description |
---|---|
array |


registerPluginResource(string | \Zend_Application_Resource_Resource $resource, mixed $options = null) : \Zend_Application_Bootstrap_BootstrapAbstract
Register a new resource plugin
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::registerPluginResource()\Zend_Application_Bootstrap_Bootstrap::registerPluginResource()Name | Type | Description |
---|---|---|
$resource | string | \Zend_Application_Resource_Resource | |
$options | mixed |
Type | Description |
---|---|
\Zend_Application_Bootstrap_BootstrapAbstract |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception | When invalid resource is provided |


run() : mixed
Checks to see that we have a default controller directory. If not, an exception is thrown.
If so, it registers the bootstrap with the 'bootstrap' parameter of the front controller, and dispatches the front controller.
Type | Description |
---|---|
mixed |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception |


setAppNamespace(string $value) : \Zend_Application_Bootstrap_Bootstrap
Set application namespace (for module autoloading)
Inherited from: \Zend_Application_Bootstrap_Bootstrap::setAppNamespace()Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
\Zend_Application_Bootstrap_Bootstrap |


setApplication(\Zend_Application | \Zend_Application_Bootstrap_Bootstrapper $application) : \Zend_Application_Bootstrap_BootstrapAbstract
Set application/parent bootstrap
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::setApplication()\Zend_Application_Bootstrap_Bootstrap::setApplication()Name | Type | Description |
---|---|---|
$application | \Zend_Application | \Zend_Application_Bootstrap_Bootstrapper |
Type | Description |
---|---|
\Zend_Application_Bootstrap_BootstrapAbstract |


setContainer(object $container) : \Zend_Application_Bootstrap_BootstrapAbstract
Set resource container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::setContainer()\Zend_Application_Bootstrap_Bootstrap::setContainer()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.
Name | Type | Description |
---|---|---|
$container | object |
Type | Description |
---|---|
\Zend_Application_Bootstrap_BootstrapAbstract |


setOptions(array $options) : \Zend_Application_Bootstrap_BootstrapAbstract
Set class state
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::setOptions()\Zend_Application_Bootstrap_Bootstrap::setOptions()Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
\Zend_Application_Bootstrap_BootstrapAbstract |


setPluginLoader(\Zend_Loader_PluginLoader_Interface $loader) : \Zend_Application_Bootstrap_BootstrapAbstract
Set plugin loader for loading resources
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::setPluginLoader()\Zend_Application_Bootstrap_Bootstrap::setPluginLoader()Name | Type | Description |
---|---|---|
$loader | \Zend_Loader_PluginLoader_Interface |
Type | Description |
---|---|
\Zend_Application_Bootstrap_BootstrapAbstract |


setResourceLoader(\Zend_Loader_Autoloader_Resource $loader) : \Zend_Application_Module_Bootstrap
Set module resource loader
Inherited from: \Zend_Application_Bootstrap_Bootstrap::setResourceLoader()Name | Type | Description |
---|---|---|
$loader | \Zend_Loader_Autoloader_Resource |
Type | Description |
---|---|
\Zend_Application_Module_Bootstrap |


unregisterPluginResource(string | \Zend_Application_Resource_Resource $resource) : \Zend_Application_Bootstrap_BootstrapAbstract
Unregister a resource from the bootstrap
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::unregisterPluginResource()\Zend_Application_Bootstrap_Bootstrap::unregisterPluginResource()Name | Type | Description |
---|---|---|
$resource | string | \Zend_Application_Resource_Resource |
Type | Description |
---|---|
\Zend_Application_Bootstrap_BootstrapAbstract |
Exception | Description |
---|---|
\Zend_Application_Bootstrap_Exception | When unknown resource type is provided |