PHP Class Ergo\Application

Inheritance: implements ergo\Plugin
Show file Open project: 99designs/ergo

Protected Properties

Property Type Description
$_registry

Public Methods

Method Description
__call ( $method, $parameters ) * (non-phpdoc)
__construct ( $classLoader = null ) Constructor
classLoader ( ) : Router Returns the class loader associateds with the application
config ( $key ) Looks up a registry key value, requires a 'config' object to be in the registry
controller ( ) Returns an application's central controller for executing requests
dateTime ( ) : object Returns the current {@link DateTime} instance in the registry, or creates a new one
errorContext ( ) Gets the error context for the application
errorHandler ( ) : object Gets the error handler for the application
errorProxy ( ) Returns the \Ergo\Error\ErrorProxy for the application
isConsole ( ) : boolean Determines if the application is running in console mode
loggerFactory ( ) Gets the logger factory used to create loggers
loggerFor ( $class ) Looks up a logger for a class or filename from the logger factory
lookup ( $key, $closure = null ) Looks up a key in the application's core registry
middleware ( $className ) Adds a middleware to the end of the middleware stack
onStart ( ) Template method, called when the application starts
onStop ( ) Template method, called when the application stops
plug ( Ergo\Plugin $plugin ) Adds a {@link \Ergo\Plugin} to the application
plugins ( ) Returns the plugins plugged into the application
rand ( $min, $max ) : integer Returns the current random number in the registry, or generates a new one
register ( $key, $object ) A shortcut for registering an object in the registry
registry ( ) Gets the application's core registry
request ( ) Returns a request object for the current http request
requestFactory ( ) Creates or sets the logger factory used to create loggers
reset ( ) Resets all internal state
router ( ) : Router Returns a request router
run ( $server = null, $stream = null ) : void Processes an HTTP request, copies response to STDOUT
setDateTime ( $dateTime ) Sets a {@link DateTime} instance in the registry, for subsequent {@link dateTime()} and {@link time()} calls
setErrorContext ( $context )
setErrorHandler ( $errorHandler ) Sets the error handler for the application
setLoggerFactory ( Ergo\Logging\LoggerFactory $factory ) Creates or sets the logger factory used to create loggers
setRand ( $rand )
setRequestFactory ( ergo\Factory $factory ) Creates or sets the logger factory used to create loggers
start ( ) * (non-phpdoc)
stop ( ) * (non-phpdoc)
time ( ) : integer Returns the current timestamp of the instance returned by {@link dateTime()}

Protected Methods

Method Description
isStarted ( ) : boolean Returns whether this application instance has been started
mixin ( ) Returns the {@link \Ergo\Mixin} instance used for plugins

Method Details

__call() public method

* (non-phpdoc)
See also: http://www.php.net/manual/en/language.oop5.overloading.php
public __call ( $method, $parameters )

__construct() public method

Constructor
public __construct ( $classLoader = null )

classLoader() public method

Returns the class loader associateds with the application
public classLoader ( ) : Router
return Router

config() public method

Looks up a registry key value, requires a 'config' object to be in the registry
public config ( $key )

controller() public method

Returns an application's central controller for executing requests
public controller ( )

dateTime() public method

Returns the current {@link DateTime} instance in the registry, or creates a new one
public dateTime ( ) : object
return object

errorContext() public method

Gets the error context for the application
public errorContext ( )

errorHandler() public method

Gets the error handler for the application
public errorHandler ( ) : object
return object

errorProxy() public method

Returns the \Ergo\Error\ErrorProxy for the application
public errorProxy ( )

isConsole() public method

Determines if the application is running in console mode
public isConsole ( ) : boolean
return boolean

isStarted() protected method

Returns whether this application instance has been started
protected isStarted ( ) : boolean
return boolean

loggerFactory() public method

Gets the logger factory used to create loggers
public loggerFactory ( )

loggerFor() public method

Looks up a logger for a class or filename from the logger factory
public loggerFor ( $class )

lookup() public method

Looks up a key in the application's core registry
See also: Ergo\Registry::lookup()
public lookup ( $key, $closure = null )

middleware() public method

Adds a middleware to the end of the middleware stack
public middleware ( $className )

mixin() protected method

Returns the {@link \Ergo\Mixin} instance used for plugins
protected mixin ( )

onStart() public method

Template method, called when the application starts
public onStart ( )

onStop() public method

Template method, called when the application stops
public onStop ( )

plug() public method

Adds a {@link \Ergo\Plugin} to the application
public plug ( Ergo\Plugin $plugin )
$plugin Ergo\Plugin

plugins() public method

Returns the plugins plugged into the application
public plugins ( )

rand() public method

Returns the current random number in the registry, or generates a new one
public rand ( $min, $max ) : integer
return integer

register() public method

A shortcut for registering an object in the registry
public register ( $key, $object )

registry() public method

Gets the application's core registry
public registry ( )

request() public method

Returns a request object for the current http request
public request ( )

requestFactory() public method

Creates or sets the logger factory used to create loggers
public requestFactory ( )

reset() public method

Resets all internal state
public reset ( )

router() public method

Returns a request router
public router ( ) : Router
return Router

run() public method

Processes an HTTP request, copies response to STDOUT
public run ( $server = null, $stream = null ) : void
return void

setDateTime() public method

Sets a {@link DateTime} instance in the registry, for subsequent {@link dateTime()} and {@link time()} calls
public setDateTime ( $dateTime )

setErrorContext() public method

public setErrorContext ( $context )

setErrorHandler() public method

Sets the error handler for the application
public setErrorHandler ( $errorHandler )

setLoggerFactory() public method

Creates or sets the logger factory used to create loggers
public setLoggerFactory ( Ergo\Logging\LoggerFactory $factory )
$factory Ergo\Logging\LoggerFactory

setRand() public method

public setRand ( $rand )

setRequestFactory() public method

Creates or sets the logger factory used to create loggers
public setRequestFactory ( ergo\Factory $factory )
$factory ergo\Factory

start() public method

* (non-phpdoc)
See also: Ergo\Plugin::start()
public start ( )

stop() public method

* (non-phpdoc)
See also: Ergo\Plugin::stop()
public stop ( )

time() public method

Returns the current timestamp of the instance returned by {@link dateTime()}
public time ( ) : integer
return integer

Property Details

$_registry protected property

protected $_registry