PHP Class Pop\Project\Project

Author: Nick Sagona, III ([email protected])
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$config Pop\Config Project config
$events Pop\Event\Manager Project events
$logger Pop\Log\Logger Project logger
$modules array Project module configs
$router Pop\Mvc\Router Project router
$services Pop\Service\Locator Project services
$start integer Project start timestamp

Public Methods

Method Description
__construct ( mixed $config = null, array $module = null, Router $router = null ) : Project Constructor
attachEvent ( string $name, mixed $action, integer $priority ) : Project Attach an event. Default project event name hook-points are:
config ( ) : Config Access the project config
database ( string $dbname ) : Db Access a project database
detachEvent ( string $name, mixed $action ) : Project Detach an event. Default project event name hook-points are:
factory ( mixed $config = null, array $module = null, Router $router = null ) : Project Static method to instantiate the project object and return itself to facilitate chaining methods together.
getEventManager ( ) : Manager Get the event Manager
getService ( string $name ) : mixed Get a service
getServiceLocator ( ) : Locator Get the service Locator
isLoaded ( string $name ) : boolean Determine whether a module is loaded
loadConfig ( mixed $config ) : Project Load a project config
loadModule ( array $module ) : Project Load a module config
loadRouter ( Router $router ) : Project Load a router
log ( string $message, integer $time = null, integer $priority = Pop\Log\Logger::INFO ) : void Log the project.
logger ( ) : Logger Access the project logger
module ( string $name ) : Config Access a project module config
modules ( ) : array Access all project module configs
router ( ) : Router Access the project router
run ( ) : void Run the project.
setService ( string $name, mixed $call, mixed $params = null ) : Project Set a service

Method Details

__construct() public method

Instantiate a project object
public __construct ( mixed $config = null, array $module = null, Router $router = null ) : Project
$config mixed
$module array
$router Pop\Mvc\Router
return Project

attachEvent() public method

route.pre route route.error route.post dispatch.pre dispatch dispatch.send dispatch.post dispatch.error
public attachEvent ( string $name, mixed $action, integer $priority ) : Project
$name string
$action mixed
$priority integer
return Project

config() public method

Access the project config
public config ( ) : Config
return Pop\Config

database() public method

Access a project database
public database ( string $dbname ) : Db
$dbname string
return Pop\Db\Db

detachEvent() public method

route.pre route route.error route.post dispatch.pre dispatch dispatch.send dispatch.post dispatch.error
public detachEvent ( string $name, mixed $action ) : Project
$name string
$action mixed
return Project

factory() public static method

Static method to instantiate the project object and return itself to facilitate chaining methods together.
public static factory ( mixed $config = null, array $module = null, Router $router = null ) : Project
$config mixed
$module array
$router Pop\Mvc\Router
return Project

getEventManager() public method

Get the event Manager
public getEventManager ( ) : Manager
return Pop\Event\Manager

getService() public method

Get a service
public getService ( string $name ) : mixed
$name string
return mixed

getServiceLocator() public method

Get the service Locator
public getServiceLocator ( ) : Locator
return Pop\Service\Locator

isLoaded() public method

Determine whether a module is loaded
public isLoaded ( string $name ) : boolean
$name string
return boolean

loadConfig() public method

Load a project config
public loadConfig ( mixed $config ) : Project
$config mixed
return Project

loadModule() public method

Load a module config
public loadModule ( array $module ) : Project
$module array
return Project

loadRouter() public method

Load a router
public loadRouter ( Router $router ) : Project
$router Pop\Mvc\Router
return Project

log() public method

Log the project.
public log ( string $message, integer $time = null, integer $priority = Pop\Log\Logger::INFO ) : void
$message string
$time integer
$priority integer
return void

logger() public method

Access the project logger
public logger ( ) : Logger
return Pop\Log\Logger

module() public method

Access a project module config
public module ( string $name ) : Config
$name string
return Pop\Config

modules() public method

Access all project module configs
public modules ( ) : array
return array

router() public method

Access the project router
public router ( ) : Router
return Pop\Mvc\Router

run() public method

Run the project.
public run ( ) : void
return void

setService() public method

Set a service
public setService ( string $name, mixed $call, mixed $params = null ) : Project
$name string
$call mixed
$params mixed
return Project

Property Details

$config protected property

Project config
protected Config,Pop $config
return Pop\Config

$events protected property

Project events
protected Manager,Pop\Event $events
return Pop\Event\Manager

$logger protected property

Project logger
protected Logger,Pop\Log $logger
return Pop\Log\Logger

$modules protected property

Project module configs
protected array $modules
return array

$router protected property

Project router
protected Router,Pop\Mvc $router
return Pop\Mvc\Router

$services protected property

Project services
protected Locator,Pop\Service $services
return Pop\Service\Locator

$start protected property

Project start timestamp
protected int $start
return integer