Application/Bootstrap/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
- Bootstrap
- Version
- $Id: Bootstrap.php 25073 2012-11-06 19:31:53Z rob $
\Zend_Application_Bootstrap_Bootstrap
Registers and utilizes Zend_Controller_Front by default.
- Parent(s)
- \Zend_Application_Bootstrap_BootstrapAbstract
- Children
- \Zend_Application_Module_Bootstrap
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
- \global\Zend_Application_Bootstrap_Bootstrap
Properties

false|string $_appNamespace = falsefalseDetails- Type
- false | string

\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $_application
array $_classResourcesInternal resource methods (resource/method pairs)
- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_classResources

object $_containerResource container
- Type
- object
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_container

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

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

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

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

array $_run = array()Initializers that have been run
array()Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_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
Methods

__call(string $method, array $args) : voidOverloading: 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) : voidConstructor
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 | mixedImplement PHP's magic to retrieve a ressource in the bootstrap
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::__get()| Name | Type | Description |
|---|---|---|
| $prop | string |
| Type | Description |
|---|---|
| null | mixed |

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

_bootstrap(null | string | array $resource = null) : voidBootstrap implementation
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_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) : voidExecute a resource
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_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 | falseLoad a plugin resource
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_loadPluginResource()| Name | Type | Description |
|---|---|---|
| $resource | string | |
| $options | array | object | null |
| Type | Description |
|---|---|
| string | false |

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

_resolvePluginResourceName(\Zend_Application_Resource_Resource $resource) : stringResolve a plugin resource name
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_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_BootstrapAbstractBootstrap individual, all, or multiple resources
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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() : stringGet application namespace (used for module autoloading)
| Type | Description |
|---|---|
| string |

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

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

getClassResources() : arrayGet class resources (as resource/method pairs)
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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() : objectRetrieve resource container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getContainer()| Type | Description |
|---|---|
| object |

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

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

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

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

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

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

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

getResource(string $name) : null | mixedRetrieve a resource from the container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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_ResourceRetrieve module resource loader
| Type | Description |
|---|---|
| \Zend_Loader_Autoloader_Resource |

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

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

hasResource(string $name) : boolDetermine if a resource has been stored in the container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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) : arrayMerge options recursively
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::mergeOptions()| Name | Type | Description |
|---|---|---|
| $array1 | array | |
| $array2 | mixed |
| Type | Description |
|---|---|
| array |

registerPluginResource(string | \Zend_Application_Resource_Resource $resource, mixed $options = null) : \Zend_Application_Bootstrap_BootstrapAbstractRegister a new resource plugin
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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() : mixedRun the application
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_BootstrapSet application namespace (for module autoloading)
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| \Zend_Application_Bootstrap_Bootstrap |

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

setContainer(object $container) : \Zend_Application_Bootstrap_BootstrapAbstractSet resource container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| \Zend_Application_Bootstrap_BootstrapAbstract |

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

setResourceLoader(\Zend_Loader_Autoloader_Resource $loader) : \Zend_Application_Module_BootstrapSet module resource loader
| Name | Type | Description |
|---|---|---|
| $loader | \Zend_Loader_Autoloader_Resource |
| Type | Description |
|---|---|
| \Zend_Application_Module_Bootstrap |

unregisterPluginResource(string | \Zend_Application_Resource_Resource $resource) : \Zend_Application_Bootstrap_BootstrapAbstractUnregister a resource from the bootstrap
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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 |