Oroboros Core
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • None
  • oroboros
    • core
      • abstracts
        • adapters
        • bootstrap
        • controllers
        • libraries
          • auth
          • bootstrap
          • cache
          • codex
          • config
          • container
          • data
          • database
          • dns
          • entity
          • enum
          • error
          • event
          • extension
          • file
          • flags
          • hooks
          • job
          • logger
          • manager
          • message
          • prototype
          • request
          • response
          • routine
          • shell
          • startup
          • stream
          • template
          • uri
          • utility
          • validation
            • workers
          • worker
        • models
        • patterns
          • behavioral
          • creational
        • utilities
          • exception
            • cache
            • container
          • http
        • views
      • interfaces
        • adapters
          • interpreters
          • sdk
        • api
          • adapters
          • bootstrap
          • controllers
          • psr
        • contract
          • adapters
          • bootstrap
          • codex
          • components
          • controllers
          • data
          • entities
          • errors
          • events
          • extensions
          • jobs
          • libraries
            • auth
            • cache
            • config
            • container
            • enum
            • file
            • flags
            • hooks
            • module
            • promise
            • record
            • request
            • response
            • server
            • shutdown
            • site
            • stream
            • template
            • theme
            • uri
          • models
          • patterns
            • behavioral
            • concurrency
            • creational
            • structural
          • routes
          • routines
            • bootload
            • declarative
            • procedural
            • subsystem
          • services
            • consumer
              • cgi
              • rest
                • local
                • remote
                  • authenticated
                  • unauthenticated
            • provider
              • cgi
              • rest
                • local
                • remote
                  • authenticated
                  • unauthenticated
          • utilities
            • datetime
            • exception
              • cache
              • container
            • filebase
            • http
            • math
            • parser
            • regex
            • session
          • views
        • enumerated
          • environment
          • flags
          • http
          • views
        • libraries
          • manager
          • worker
      • libraries
        • api
        • codex
        • container
        • enum
          • http
        • file
        • hooks
        • logger
        • math
        • psr4
        • request
        • response
        • stream
        • uri
      • patterns
        • creational
      • traits
        • adapters
        • bootstrap
        • codex
        • components
        • controllers
        • data
        • entities
        • events
        • extensions
        • jobs
        • libraries
          • container
          • file
          • request
          • response
          • stream
          • uri
        • models
        • modules
        • patterns
          • behavioral
          • concurrency
          • creational
          • structural
        • routes
        • services
        • utilities
          • core
            • api
            • config
            • contract
              • contract
            • enum
            • environment
            • routines
          • datetime
          • error
          • exception
          • filebase
          • hooks
          • html
          • http
          • logic
          • math
          • parsers
          • regex
          • session
        • views
      • utilities
        • exception
          • cache
          • container
        • http
      • views
    • tests
      • patterns
        • creational
      • psr
        • psr7
      • utilities
        • exception
  • PasswordCompat
    • binary
  • PHP

Traits

  • BootstrapTrait

Trait BootstrapTrait

Satisfies the BootstrapContract requirements. Using this trait and implementing that contract interface should give you a fully functional bootstrap object that honors it's api on any class that does not collide with it's declared methods, with no additional work.


Traits provide extended method support to classes without requiring a direct, linear chain of inheritance. This allows functions to inherit subsets of related methods without declaring a parent class.

In Oroboros core, ALL methods are granted to classes via traits, and the classes themselves are just containers that correlate their methods to an interface they are expected to honor. This approach maximizes interoperability, by entirely removing class inheritance as a requirement for extension of any class in this system.

3rd parties using this package are not expected to follow this approach,

but ALL of our internal class and logic structure does.

oroboros\core\traits\bootstrap\BootstrapTrait uses oroboros\core\traits\BaseTrait, oroboros\core\traits\patterns\behavioral\Registry (not available) oroboros\core\traits\patterns\creational\factory\FactoryFactory (not available)

Direct Known Users

oroboros\core\abstracts\bootstrap\AbstractBootstrap

Indirect Known Users

Bootstrap

Namespace: oroboros\core\traits\bootstrap
Package: oroboros\core\bootstrap
Category: traits
License: The MIT License (MIT)
Author: Brian Dayhoff mopsyd@me.com
Version: 0.2.4-alpha
Since: 0.2.4-alpha
Link: bitbucket.org/oroborosframework/oroboros-core/wiki/development/api/contract_interface.md
Default: \oroboros\core\bootstrap\Bootstrap
Requires: \oroboros\core\interfaces\api\EnvironmentApi
Satisfies: \oroboros\core\interfaces\contract\bootstrap\BootstrapContract
Satisfies: \oroboros\core\interfaces\contract\utilities\UtilityContract
Satisfies: \oroboros\core\interfaces\contract\BaseContract
Located at core/traits/bootstrap/BootstrapTrait.php

Methods summary

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

$params
$flags
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

$params
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

$flags
$params
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

$params

Returns

type
private boolean
# _validateInitializationParams( mixed $flags )

Checks if the flags are anything useable.

Checks if the flags are anything useable.

Parameters

$flags

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

$flags

Properties summary

Properties used from oroboros\core\traits\BaseTrait

$_constructed

Oroboros Core API documentation generated by ApiGen