API Documentation

Zend/Application/Bootstrap/BootstrapAbstract.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 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: BootstrapAbstract.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Application_Bootstrap_BootstrapAbstract

Package: Zend\Application\Bootstrap

Abstract base class for bootstrap classes

Implements
\Zend_Application_Bootstrap_Bootstrapper
\Zend_Application_Bootstrap_ResourceBootstrapper
Children
\Zend_Application_Bootstrap_Bootstrap
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
\Zend_Application_Bootstrap_Bootstrapper  
Uses
\Zend_Application_Bootstrap_ResourceBootstrapper  

Properties

Propertyprotected\Zend_Application|\Zend_Application_Bootstrap_Bootstrapper  $_application= ''

Propertyprotectedarray  $_classResources= ''

Internal resource methods (resource/method pairs)
Details
Type
array
Propertyprotectedobject  $_container= ''

Resource container
Details
Type
object
Propertyprotectedstring  $_environment= ''

Details
Type
string
Propertyprotectedarray  $_optionKeys= 'array()'

Flattened (lowercase) option keys used for lookups

Default valuearray()Details
Type
array
Propertyprotectedarray  $_options= 'array()'

Default valuearray()Details
Type
array
Propertyprotected\Zend_Loader_PluginLoader_Interface  $_pluginLoader= ''

Propertyprotectedarray  $_pluginResources= 'array()'

Class-based resource plugins
Default valuearray()Details
Type
array
Propertyprotectedarray  $_run= 'array()'

Initializers that have been run
Default valuearray()Details
Type
array
Propertyprotectedarray  $_started= 'array()'

Initializers that have been started but not yet completed (circular dependency detection)
Default valuearray()Details
Type
array

Methods

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

Overloading: intercept calls to bootstrap() methods

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

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

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

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

Parameters
Name Type Description
$prop string
Returns
Type Description
null|mixed
methodpublic__isset( string $prop ) : bool

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

Parameters
Name Type Description
$prop string
Returns
Type Description
bool
methodprotected_bootstrap( null|string|array $resource = null ) : void

Bootstrap implementation

This method may be overridden to provide custom bootstrapping logic. It is the sole method called by {@link 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

Execute a resource

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

Load a plugin resource

Parameters
Name Type Description
$resource string
$options array|object|null
Returns
Type Description
string|false
methodprotected_markRun( string $resource ) : void

Mark a resource as having run

Parameters
Name Type Description
$resource string
methodprotected_resolvePluginResourceName( \Zend_Application_Resource_Resource $resource ) : string

Resolve a plugin resource name

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
final

Bootstrap individual, all, or multiple resources

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 {@link _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
methodpublicgetApplication( ) : \Zend_Application|\Zend_Application_Bootstrap_Bootstrapper

Retrieve parent application instance

methodpublicgetClassResourceNames( ) : array

Get class resource names

Returns
Type Description
array
methodpublicgetClassResources( ) : array

Get class resources (as resource/method pairs)

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

Retrieve resource container

Returns
Type Description
object
methodpublicgetEnvironment( ) : string

Retrieve application environment

Returns
Type Description
string
methodpublicgetOption( string $key ) : mixed

Retrieve a single option

Parameters
Name Type Description
$key string
Returns
Type Description
mixed
methodpublicgetOptions( ) : array

Get current options from bootstrap

Returns
Type Description
array
methodpublicgetPluginLoader( ) : \Zend_Loader_PluginLoader_Interface

Get the plugin loader for resources

Returns
Type Description
\Zend_Loader_PluginLoader_Interface
methodpublicgetPluginResource(  $resource ) : \Zend_Application_Resource_Resource

Get a registered plugin resource

Parameters
Name Type Description
$resource
Returns
Type Description
\Zend_Application_Resource_Resource
methodpublicgetPluginResourceNames( ) : array

Retrieve plugin resource names

Returns
Type Description
array
methodpublicgetPluginResources( ) : array

Retrieve all plugin resources

Returns
Type Description
array
methodpublicgetResource( string $name ) : null|mixed

Retrieve a resource from the container

During bootstrap resource initialization, you may return a value. If you do, it will be stored in the {@link setContainer() 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
methodpublichasOption( string $key ) : bool

Is an option present?

Parameters
Name Type Description
$key string
Returns
Type Description
bool
methodpublichasPluginResource( string $resource ) : bool

Is the requested plugin resource registered?

Parameters
Name Type Description
$resource string
Returns
Type Description
bool
methodpublichasResource( string $name ) : bool

Determine if a resource has been stored in the container

During bootstrap resource initialization, you may return a value. If you do, it will be stored in the {@link setContainer() 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

Merge options recursively

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

Register a new resource plugin

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
methodpublicsetApplication( \Zend_Application|\Zend_Application_Bootstrap_Bootstrapper $application ) : \Zend_Application_Bootstrap_BootstrapAbstract

Set application/parent bootstrap

Parameters
Name Type Description
$application \Zend_Application|\Zend_Application_Bootstrap_Bootstrapper
Returns
Type Description
\Zend_Application_Bootstrap_BootstrapAbstract
methodpublicsetContainer( object $container ) : \Zend_Application_Bootstrap_BootstrapAbstract

Set resource container

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

Set class state

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

Set plugin loader for loading resources

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

Unregister a resource from the bootstrap

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 DocBlox 0.15.1.