public
|
#
__construct( mixed $params = null, mixed $flags = null )
Instantiates the bootstrap object.
Can be called with no parameters, but accepts substitution parameters
for unit testing specific requests, or requesting specific functionality
that is normally out of scope for the current environment. Also accepts
flags, which it will propogate to any controllers that it references
automatically through dependency injection.
Instantiates the bootstrap object.
Can be called with no parameters, but accepts substitution parameters
for unit testing specific requests, or requesting specific functionality
that is normally out of scope for the current environment. Also accepts
flags, which it will propogate to any controllers that it references
automatically through dependency injection.
If you intend to do full initialization within the constructor,
you should call the initialize method manually within your constructor,
and still place your initialization logic in that method.
This allows for re-initialization without the weight of creating
a new object.
Parameters
- $params
- (optional) An array of parameters to pass into the bootstrap, to replace it's normally defined values. This may be used for unit-testing the bootstrap process with specific overrides of local dependencies before deploying them into the normal codebase, or to create a localized bootstrap that works as a subroutine, with custom parameters it would not otherwise use.
- $flags
- (optional) An array of flags to pass into the bootstrap, which will be propogated to controllers and routers it controls to modify their behavior. This presents a simple way for setting up debug, testing, profiling, or benchmarking paradigms, and allows for an easy way to pass environmental considerations (such as dev vs production), that will automatically propogate through all subsequent objects in the stack on execution.
Returns
$this;
|
public
|
#
__destruct( )
The Bootstrap destructor MUST release all dependent objects and
their children, and manually release it's memory footprint also.
It should be configured to tell the webserver not to reserve it's
memory and release it back into the pool for the actual machine
hardware as well (apache does not do this by default, which can
be problematic on servers with low memory or a lot of shared threads),
though this action SHALL NOT be executed unless explicitly requested
via a flag passed at either instantiation, initialization, or reset.
The Bootstrap destructor MUST release all dependent objects and
their children, and manually release it's memory footprint also.
It should be configured to tell the webserver not to reserve it's
memory and release it back into the pool for the actual machine
hardware as well (apache does not do this by default, which can
be problematic on servers with low memory or a lot of shared threads),
though this action SHALL NOT be executed unless explicitly requested
via a flag passed at either instantiation, initialization, or reset.
|
public
|
#
initialize( array $params = null, array $flags = null )
Initializes the bootstrap object.
This method separates instantiation from initialization, and provides a
reset point to restore to in the event that instantiation did not pass
all of the values required, or if you needed multiple instances of the
bootstrap object with different parameters.
Initializes the bootstrap object.
This method separates instantiation from initialization, and provides a
reset point to restore to in the event that instantiation did not pass
all of the values required, or if you needed multiple instances of the
bootstrap object with different parameters.
This method should contain ALL logic that needs to be performed prior
to execution of the primary task of the Bootstrap object.
Parameters
|
public
|
#
reset( array $params = null, array $flags = null )
Resets the Bootstrap object to its state immediately after execution
fires successfully, so it is initialized, but does not have any
remnant data that was obtained through any action that occurred
after initialization. The purpose of this method is to allow a
degree of external control over the execution plan, and allow it
to be called repeatedly if needed, without the weight of
reinitialization.
Resets the Bootstrap object to its state immediately after execution
fires successfully, so it is initialized, but does not have any
remnant data that was obtained through any action that occurred
after initialization. The purpose of this method is to allow a
degree of external control over the execution plan, and allow it
to be called repeatedly if needed, without the weight of
reinitialization.
Parameters
- $params
- (optional) If params are passed, they will replace the values known under the same key that were obtained during initialization. If not passed, they will be ignored.
- $flags
- (optional) If params are passed, they will replace the flags that were passed or obtained during initialization. If not passed, they will be ignored.
|
public
|
#
launch( )
Launches the application.
If the bootstrap has not already initialized fully, it will do so at
this point using it's default values (bootstraps should be capable of
autonomous operation, but not assume it).
Launches the application.
If the bootstrap has not already initialized fully, it will do so at
this point using it's default values (bootstraps should be capable of
autonomous operation, but not assume it).
At this point it will obtain it's routes, check for a match,
load the appropriate controller if a match is found,
load the default (or supplied) error controller if no match is found,
initialize it's selected controller and pass any flags into it that
were given to the bootstrap, and execute the controller route.
|
public
|
#
shutdown( )
This method terminates the bootstrap object, and causes it to release
all objects that it has instantiated along with their own chid objects.
This should clear it's entire stack and memory footprint, and leave the
bootstrap in an empty, uninitialized state. This SHALL NOT terminate
the object, but will leave it to be either reinitialized or unset as
determined by it's controlling logic.
This method terminates the bootstrap object, and causes it to release
all objects that it has instantiated along with their own chid objects.
This should clear it's entire stack and memory footprint, and leave the
bootstrap in an empty, uninitialized state. This SHALL NOT terminate
the object, but will leave it to be either reinitialized or unset as
determined by it's controlling logic.
|
protected
|
#
_handleParams( array $params = null )
This method provides an overrideable way to
filter params to any construct that extends this logic.
This method provides an overrideable way to
filter params to any construct that extends this logic.
The actual param work is done privately for stability,
but this method allows for overrides that are still
not publicly accessible as needed.
Child classes and traits can perform any operations
needed prior to calling parent::_handleParams
Parameters
|
protected
|
#
_handleFlags( array $flags = null )
This method provides an overrideable way to
filter flags to any construct that extends this logic.
This method provides an overrideable way to
filter flags to any construct that extends this logic.
The actual param work is done privately for stability,
but this method allows for overrides that are still
not publicly accessible as needed.
Child classes and traits can perform any operations
needed prior to calling parent::_handleFlags
Parameters
|
private
type
|
#
_parseInitializationParams( array $params = null )
This method parses the initialization parameters,
which may occur during instantiation,
during initialization,
or during reset.
This method parses the initialization parameters,
which may occur during instantiation,
during initialization,
or during reset.
Parameters
Returns
type
|
private
boolean
|
#
_validateInitializationParams( mixed $flags )
Checks if the flags are anything useable.
Checks if the flags are anything useable.
Parameters
Returns
boolean
|
private
|
#
_parseInitializationFlags( array $flags = null )
This method parses the initialization flags,
which may occur during instantiation,
during initialization,
or during reset.
This method parses the initialization flags,
which may occur during instantiation,
during initialization,
or during reset.
Parameters
|