Application/Bootstrap/Bootstrap.php
Zend Framework
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 [email protected] 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
Concrete base class for bootstrap classes
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 = false
Application resource namespace
false
Details- Type
- false | string


\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $_application =


array $_classResources =
- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_classResources


object $_container =
- Type
- object
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_container


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


array $_optionKeys = array()
Flattened (lowercase) option keys used for lookups
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::$$_optionKeysarray()
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()
array()
Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_pluginResources


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


array $_started = array()
array()
Details- Type
- array
- Inherited_from
- \Zend_Application_Bootstrap_BootstrapAbstract::$$_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()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()Name | Type | Description |
---|---|---|
$prop | string |
Type | Description |
---|---|
bool |


_bootstrap(null | string | array $resource = null) : void
Bootstrap 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) : void
Execute 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 | false
Load 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) : void
Mark a resource as having run
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_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()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()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 application namespace (used for module autoloading)
Type | Description |
---|---|
string |


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


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


getClassResources() : array
Get 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() : object
Retrieve resource container
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getContainer()Type | Description |
---|---|
object |


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


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


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


getPluginLoader() : \Zend_Loader_PluginLoader_Interface
Get the plugin loader for resources
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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()Name | Type | Description |
---|---|---|
$resource |
Type | Description |
---|---|
\Zend_Application_Resource_Resource |


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


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


getResource(string $name) : null | mixed
Retrieve 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_Resource
Retrieve module resource loader
Type | Description |
---|---|
\Zend_Loader_Autoloader_Resource |


hasOption(string $key) : bool
Is an option present?
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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()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()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()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()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
Run 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( $value) : \Zend_Application_Bootstrap_Bootstrap
Set 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_BootstrapAbstract
Set 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_BootstrapAbstract
Set 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
Set class state
Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::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()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
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()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 |