Application/Bootstrap/Bootstrap.php

Show: inherited
Table of Contents

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

Package: Zend\Application\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

Propertyprotectedfalse|string $_appNamespace = false

Application resource namespace

Default valuefalseDetails
Type
false | string
Propertyprotected\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $_application =
Propertyprotectedarray $_classResources =
inherited<p>Internal resource methods (resource/method pairs)</p>

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::$$_classResources
Propertyprotectedobject $_container =
inherited<p>Resource container</p>

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::$$_container
Details
Type
object
Inherited_from
\Zend_Application_Bootstrap_BootstrapAbstract::$$_container  
Propertyprotectedstring $_environment =
Propertyprotectedarray $_optionKeys = array()
inherited

Flattened (lowercase) option keys used for lookups

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::$$_optionKeys
Default valuearray()Details
Type
array
Inherited_from
\Zend_Application_Bootstrap_BootstrapAbstract::$$_optionKeys  
Propertyprotectedarray $_options = array()
Default valuearray()Details
Type
array
Inherited_from
\Zend_Application_Bootstrap_BootstrapAbstract::$$_options  
Propertyprotected\Zend_Loader_PluginLoader_Interface $_pluginLoader =
Propertyprotectedarray $_pluginResources = array()
inherited<p>Class-based resource plugins</p>

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::$$_pluginResources
Default valuearray()Details
Type
array
Inherited_from
\Zend_Application_Bootstrap_BootstrapAbstract::$$_pluginResources  
Propertyprotected\Zend_Loader_Autoloader_Resource $_resourceLoader =

Application resource autoloader

Propertyprotectedarray $_run = array()
inherited<p>Initializers that have been run</p>

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::$$_run
Default valuearray()Details
Type
array
Inherited_from
\Zend_Application_Bootstrap_BootstrapAbstract::$$_run  
Propertyprotectedarray $_started = array()
inherited<p>Initializers that have been started but not yet completed (circular dependency detection)</p>

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::$$_started
Default valuearray()Details
Type
array
Inherited_from
\Zend_Application_Bootstrap_BootstrapAbstract::$$_started  

Methods

methodpublic__call(string $method, array $args) : void
inherited

Overloading: intercept calls to bootstrap() methods

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::__call()
Parameters
Name Type Description
$method string
$args array
Throws
Exception Description
\Zend_Application_Bootstrap_Exception On invalid method name
methodpublic__construct(\Zend_Application | \Zend_Application_Bootstrap_Bootstrapper $application) : void

Constructor

Ensure FrontController resource is registered

Parameters
Name Type Description
$application \Zend_Application | \Zend_Application_Bootstrap_Bootstrapper
Throws
Exception Description
\Zend_Application_Bootstrap_Exception When invalid application is provided
methodpublic__get(string $prop) : null | mixed
inherited

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

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::__get()
Parameters
Name Type Description
$prop string
Returns
Type Description
null | mixed
methodpublic__isset(string $prop) : bool
inherited

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

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::__isset()
Parameters
Name Type Description
$prop string
Returns
Type Description
bool
methodprotected_bootstrap(null | string | array $resource = null) : void
inherited

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().

Parameters
Name Type Description
$resource null | string | array
Throws
Exception Description
\Zend_Application_Bootstrap_Exception When invalid argument was passed
methodprotected_executeResource(string $resource) : void
inherited

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.

Parameters
Name Type Description
$resource string
Throws
Exception Description
\Zend_Application_Bootstrap_Exception When resource not found
methodprotected_loadPluginResource(string $resource, array | object | null $options) : string | false
inherited

Load a plugin resource

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_loadPluginResource()
Parameters
Name Type Description
$resource string
$options array | object | null
Returns
Type Description
string | false
methodprotected_markRun(string $resource) : void
inherited

Mark a resource as having run

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::_markRun()
Parameters
Name Type Description
$resource string
methodprotected_resolvePluginResourceName(\Zend_Application_Resource_Resource $resource) : string
inherited

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.

Parameters
Name Type Description
$resource \Zend_Application_Resource_Resource
Returns
Type Description
string
methodpublicbootstrap(null | string | array $resource = null) : \Zend_Application_Bootstrap_BootstrapAbstract
finalinherited

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.

Parameters
Name Type Description
$resource null | string | array
Returns
Type Description
\Zend_Application_Bootstrap_BootstrapAbstract
Throws
Exception Description
\Zend_Application_Bootstrap_Exception When invalid argument was passed
methodpublicgetAppNamespace() : string

Get application namespace (used for module autoloading)

Returns
Type Description
string
methodpublicgetClassResourceNames() : array
inherited

Get class resource names

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getClassResourceNames()
Returns
Type Description
array
methodpublicgetClassResources() : array
inherited

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.

Returns
Type Description
array
methodpublicgetContainer() : object
inherited

Retrieve resource container

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getContainer()
Returns
Type Description
object
methodpublicgetEnvironment() : string
inherited

Retrieve application environment

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getEnvironment()
Returns
Type Description
string
methodpublicgetOption(string $key) : mixed
inherited

Retrieve a single option

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getOption()
Parameters
Name Type Description
$key string
Returns
Type Description
mixed
methodpublicgetOptions() : array
inherited

Get current options from bootstrap

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getOptions()
Returns
Type Description
array
methodpublicgetPluginLoader() : \Zend_Loader_PluginLoader_Interface
inherited

Get the plugin loader for resources

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginLoader()
Returns
Type Description
\Zend_Loader_PluginLoader_Interface
methodpublicgetPluginResource( $resource) : \Zend_Application_Resource_Resource
inherited

Get a registered plugin resource

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginResource()
Parameters
Name Type Description
$resource
Returns
Type Description
\Zend_Application_Resource_Resource
methodpublicgetPluginResourceNames() : array
inherited

Retrieve plugin resource names

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginResourceNames()
Returns
Type Description
array
methodpublicgetPluginResources() : array
inherited

Retrieve all plugin resources

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::getPluginResources()
Returns
Type Description
array
methodpublicgetResource(string $name) : null | mixed
inherited

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.

Parameters
Name Type Description
$name string
Returns
Type Description
null | mixed
methodpublicgetResourceLoader() : \Zend_Loader_Autoloader_Resource

Retrieve module resource loader

Returns
Type Description
\Zend_Loader_Autoloader_Resource
methodpublichasOption(string $key) : bool
inherited

Is an option present?

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::hasOption()
Parameters
Name Type Description
$key string
Returns
Type Description
bool
methodpublichasPluginResource(string $resource) : bool
inherited

Is the requested plugin resource registered?

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::hasPluginResource()
Parameters
Name Type Description
$resource string
Returns
Type Description
bool
methodpublichasResource(string $name) : bool
inherited

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.

Parameters
Name Type Description
$name string
Returns
Type Description
bool
methodpublicmergeOptions(array $array1, mixed $array2 = null) : array
inherited

Merge options recursively

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::mergeOptions()
Parameters
Name Type Description
$array1 array
$array2 mixed
Returns
Type Description
array
methodpublicregisterPluginResource(string | \Zend_Application_Resource_Resource $resource, mixed $options = null) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited

Register a new resource plugin

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::registerPluginResource()
Parameters
Name Type Description
$resource string | \Zend_Application_Resource_Resource
$options mixed
Returns
Type Description
\Zend_Application_Bootstrap_BootstrapAbstract
Throws
Exception Description
\Zend_Application_Bootstrap_Exception When invalid resource is provided
methodpublicrun() : 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.

Returns
Type Description
mixed
Throws
Exception Description
\Zend_Application_Bootstrap_Exception
methodpublicsetAppNamespace( $value) : \Zend_Application_Bootstrap_Bootstrap

Set application namespace (for module autoloading)

Parameters
Name Type Description
$value

string

Returns
Type Description
\Zend_Application_Bootstrap_Bootstrap
methodpublicsetContainer(object $container) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited

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.

Parameters
Name Type Description
$container object
Returns
Type Description
\Zend_Application_Bootstrap_BootstrapAbstract
methodpublicsetOptions(array $options) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited

Set class state

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::setOptions()
Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Application_Bootstrap_BootstrapAbstract
methodpublicsetPluginLoader(\Zend_Loader_PluginLoader_Interface $loader) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited

Set plugin loader for loading resources

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::setPluginLoader()
Parameters
Name Type Description
$loader \Zend_Loader_PluginLoader_Interface
Returns
Type Description
\Zend_Application_Bootstrap_BootstrapAbstract
methodpublicsetResourceLoader(\Zend_Loader_Autoloader_Resource $loader) : \Zend_Application_Module_Bootstrap

Set module resource loader

Parameters
Name Type Description
$loader \Zend_Loader_Autoloader_Resource
Returns
Type Description
\Zend_Application_Module_Bootstrap
methodpublicunregisterPluginResource(string | \Zend_Application_Resource_Resource $resource) : \Zend_Application_Bootstrap_BootstrapAbstract
inherited

Unregister a resource from the bootstrap

Inherited from: \Zend_Application_Bootstrap_BootstrapAbstract::unregisterPluginResource()
Parameters
Name Type Description
$resource string | \Zend_Application_Resource_Resource
Returns
Type Description
\Zend_Application_Bootstrap_BootstrapAbstract
Throws
Exception Description
\Zend_Application_Bootstrap_Exception When unknown resource type is provided
Documentation was generated by phpDocumentor 2.0.0a8.