API Documentation

Application/Bootstrap/BootstrapAbstract.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Application
subpackage
Bootstrap
version
$Id: BootstrapAbstract.php 22665 2010-07-25 00:40:37Z ramon $
Classes
Zend_Application_Bootstrap_BootstrapAbstract

Description

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.

Zend_Application_Bootstrap_BootstrapAbstract

Implements
Zend_Application_Bootstrap_Bootstrapper
Zend_Application_Bootstrap_ResourceBootstrapper
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Application
subpackage
Bootstrap
uses
Zend_Application_Bootstrap_Bootstrapper
uses
Zend_Application_Bootstrap_ResourceBootstrapper
Properties
$_application
$_classResources
$_container
$_environment
$_optionKeys
$_options
$_pluginLoader
$_pluginResources
$_run
$_started
Methods
__construct
setOptions
getOptions
hasOption
getOption
mergeOptions
getClassResources
getClassResourceNames
registerPluginResource
unregisterPluginResource
hasPluginResource
getPluginResource
getPluginResources
getPluginResourceNames
setPluginLoader
getPluginLoader
setApplication
getApplication
getEnvironment
setContainer
getContainer
hasResource
getResource
__get
__isset
bootstrap
__call
_bootstrap
_executeResource
_loadPluginResource
_markRun
_resolvePluginResourceName

Description

Abstract base class for bootstrap classes

Properties

$_application

Zend_Application|Zend_Application_Bootstrap_Bootstrapper $_application = ''

Details

$_application
Zend_Application|Zend_Application_Bootstrap_Bootstrapper
visibility
protected
default
final
false
static
false

$_classResources

array $_classResources = ''

Details

$_classResources
array
Internal resource methods (resource/method pairs)
visibility
protected
default
final
false
static
false

$_container

object $_container = ''

Details

$_container
object
Resource container
visibility
protected
default
final
false
static
false

$_environment

string $_environment = ''

Details

$_environment
string
visibility
protected
default
final
false
static
false

$_optionKeys

array $_optionKeys = 'array'

Flattened (lowercase) option keys used for lookups

Details

$_optionKeys
array
visibility
protected
default
array
final
false
static
false

$_options

array $_options = 'array'

Details

$_options
array
visibility
protected
default
array
final
false
static
false

$_pluginLoader

Zend_Loader_PluginLoader_Interface $_pluginLoader = ''

Details

$_pluginLoader
Zend_Loader_PluginLoader_Interface
visibility
protected
default
final
false
static
false

$_pluginResources

array $_pluginResources = 'array'

Details

$_pluginResources
array
Class-based resource plugins
visibility
protected
default
array
final
false
static
false

$_run

array $_run = 'array'

Details

$_run
array
Initializers that have been run
visibility
protected
default
array
final
false
static
false

$_started

array $_started = 'array'

Details

$_started
array
Initializers that have been started but not yet completed (circular dependency detection)
visibility
protected
default
array
final
false
static
false

Methods

__call

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

Overloading: intercept calls to bootstrap<resourcename>() methods

Arguments
$method
string
$args
array
Details
visibility
public
final
false
static
false
throws
On invalid method name

__construct

__construct( Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application ) : void

Constructor

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

Arguments
$application
Zend_ApplicationZend_Application_Bootstrap_Bootstrapper
Details
visibility
public
final
false
static
false
throws
When invalid applicaiton is provided

__get

__get( string $prop ) : null|mixed

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

Arguments
$prop
string
Output
null|mixed
Details
visibility
public
final
false
static
false

__isset

__isset( string $prop ) : bool

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

Arguments
$prop
string
Output
bool
Details
visibility
public
final
false
static
false

_bootstrap

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

Arguments
$resource
nullstringarray
Details
visibility
protected
final
false
static
false
throws
When invalid argument was passed

_executeResource

_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.

Arguments
$resource
string
Details
visibility
protected
final
false
static
false
throws
When resource not found

_loadPluginResource

_loadPluginResource( string $resource, array|object|null $options ) : string|false

Load a plugin resource

Arguments
$resource
string
$options
arrayobjectnull
Output
string|false
Details
visibility
protected
final
false
static
false

_markRun

_markRun( string $resource ) : void

Mark a resource as having run

Arguments
$resource
string
Details
visibility
protected
final
false
static
false

_resolvePluginResourceName

_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.

Arguments
$resource
Zend_Application_Resource_Resource
Output
string
Details
visibility
protected
final
false
static
false

bootstrap

bootstrap( null|string|array $resource = null ) : Zend_Application_Bootstrap_BootstrapAbstract

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.

Arguments
$resource
nullstringarray
Details
visibility
public
final
true
static
false
throws
When invalid argument was passed

getApplication

getApplication( ) : Zend_Application|Zend_Application_Bootstrap_Bootstrapper

Retrieve parent application instance

Details
visibility
public
final
false
static
false

getClassResourceNames

getClassResourceNames( ) : array

Get class resource names

Output
array
Details
visibility
public
final
false
static
false

getClassResources

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

Output
array
Details
visibility
public
final
false
static
false

getContainer

getContainer( ) : object

Retrieve resource container

Output
object
Details
visibility
public
final
false
static
false

getEnvironment

getEnvironment( ) : string

Retrieve application environment

Output
string
Details
visibility
public
final
false
static
false

getOption

getOption( string $key ) : mixed

Retrieve a single option

Arguments
$key
string
Output
mixed
Details
visibility
public
final
false
static
false

getOptions

getOptions( ) : array

Get current options from bootstrap

Output
array
Details
visibility
public
final
false
static
false

getPluginLoader

getPluginLoader( ) : Zend_Loader_PluginLoader_Interface

Get the plugin loader for resources

Details
visibility
public
final
false
static
false

getPluginResource

getPluginResource(  $resource ) : Zend_Application_Resource_Resource

Get a registered plugin resource

Arguments
$resource
Details
visibility
public
final
false
static
false

getPluginResourceNames

getPluginResourceNames( ) : array

Retrieve plugin resource names

Output
array
Details
visibility
public
final
false
static
false

getPluginResources

getPluginResources( ) : array

Retrieve all plugin resources

Output
array
Details
visibility
public
final
false
static
false

getResource

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

Arguments
$name
string
Output
null|mixed
Details
visibility
public
final
false
static
false

hasOption

hasOption( string $key ) : bool

Is an option present?

Arguments
$key
string
Output
bool
Details
visibility
public
final
false
static
false

hasPluginResource

hasPluginResource( string $resource ) : bool

Is the requested plugin resource registered?

Arguments
$resource
string
Output
bool
Details
visibility
public
final
false
static
false

hasResource

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

Arguments
$name
string
Output
bool
Details
visibility
public
final
false
static
false

mergeOptions

mergeOptions( array $array1, mixed $array2 = null ) : array

Merge options recursively

Arguments
$array1
array
$array2
mixed
Output
array
Details
visibility
public
final
false
static
false

registerPluginResource

registerPluginResource( string|Zend_Application_Resource_Resource $resource, mixed $options = null ) : Zend_Application_Bootstrap_BootstrapAbstract

Register a new resource plugin

Arguments
$resource
stringZend_Application_Resource_Resource
$options
mixed
Details
visibility
public
final
false
static
false
throws
When invalid resource is provided

setApplication

setApplication( Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application ) : Zend_Application_Bootstrap_BootstrapAbstract

Set application/parent bootstrap

Arguments
$application
Zend_ApplicationZend_Application_Bootstrap_Bootstrapper
Details
visibility
public
final
false
static
false

setContainer

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

Arguments
$container
object
Details
visibility
public
final
false
static
false

setOptions

setOptions( array $options ) : Zend_Application_Bootstrap_BootstrapAbstract

Set class state

Arguments
$options
array
Details
visibility
public
final
false
static
false

setPluginLoader

setPluginLoader( Zend_Loader_PluginLoader_Interface $loader ) : Zend_Application_Bootstrap_BootstrapAbstract

Set plugin loader for loading resources

Arguments
$loader
Zend_Loader_PluginLoader_Interface
Details
visibility
public
final
false
static
false

unregisterPluginResource

unregisterPluginResource( string|Zend_Application_Resource_Resource $resource ) : Zend_Application_Bootstrap_BootstrapAbstract

Unregister a resource from the bootstrap

Arguments
$resource
stringZend_Application_Resource_Resource
Details
visibility
public
final
false
static
false
throws
When unknown resource type is provided
Documentation was generated by DocBlox.