Properties

$config

$config : mixed

Application config

Type

mixed

$autoloader

$autoloader : mixed

Autoloader

Type

mixed

$routes

$routes : array

Routes array

Type

array

Methods

__construct()

__construct() 

Constructor

Instantiate an application object

Optional parameters are a service locator instance, a router instance, an event manager instance or a configuration object or array

bootstrap()

bootstrap(mixed  $autoloader = null) : \Pop\Application

Bootstrap the application, creating the required objects if they haven't been created yet and registering with the autoloader, adding routes, services and events

Parameters

mixed $autoloader

Returns

\Pop\Application

mergeConfig()

mergeConfig(mixed  $config, boolean  $preserve = false) : \Pop\Application

Merge new or altered config values with the existing config values

Parameters

mixed $config
boolean $preserve

Returns

\Pop\Application

init()

init() : \Pop\Application

Initialize the application

Returns

\Pop\Application

autoloader()

autoloader() : mixed

Get the autoloader object

Returns

mixed

config()

config() : mixed

Access application config

Returns

mixed

router()

router() : \Pop\Router\Router

Access the application router

Returns

\Pop\Router\Router

modules()

modules() : \Pop\Module\Manager

Access all application module configs

Returns

\Pop\Module\Manager

registerConfig()

registerConfig(mixed  $config) : \Pop\Application

Register a new configuration with the application

Parameters

mixed $config

Throws

\InvalidArgumentException

Returns

\Pop\Application

registerRouter()

registerRouter(\Pop\Router\Router  $router) : \Pop\Application

Register a new router object with the application

Parameters

\Pop\Router\Router $router

Returns

\Pop\Application

registerServices()

registerServices(\Pop\Service\Locator  $services) : \Pop\Application

Register a new service locator object with the application

Parameters

\Pop\Service\Locator $services

Returns

\Pop\Application

registerEvents()

registerEvents(\Pop\Event\Manager  $events) : \Pop\Application

Register a new event manager object with the application

Parameters

\Pop\Event\Manager $events

Returns

\Pop\Application

registerModules()

registerModules(\Pop\Module\Manager  $modules) : \Pop\Application

Register a new module manager object with the application

Parameters

\Pop\Module\Manager $modules

Returns

\Pop\Application

registerAutoloader()

registerAutoloader(mixed  $autoloader) : \Pop\Application

Register the autoloader object with the application

Parameters

mixed $autoloader

Throws

\Pop\Exception

Returns

\Pop\Application

module()

module(string  $name) : \Pop\Module\ModuleInterface

Access a module object

Parameters

string $name

Returns

\Pop\Module\ModuleInterface

register()

register(mixed  $module, string  $name = null) : \Pop\Application

Register a module with the module manager object

Parameters

mixed $module
string $name

Returns

\Pop\Application

unregister()

unregister(string  $name) : \Pop\Application

Unregister a module with the module manager object

Parameters

string $name

Returns

\Pop\Application

isRegistered()

isRegistered(string  $name) : boolean

Determine whether a module is registered with the application object

Parameters

string $name

Returns

boolean

addRoute()

addRoute(string  $route, mixed  $controller) : \Pop\Application

Add a route

Parameters

string $route
mixed $controller

Returns

\Pop\Application

addRoutes()

addRoutes(array  $routes) : \Pop\Application

Add routes

Parameters

array $routes

Returns

\Pop\Application

setService()

setService(string  $name, mixed  $service) : \Pop\Application

Set a service

Parameters

string $name
mixed $service

Returns

\Pop\Application

getService()

getService(string  $name) : mixed

Get a service

Parameters

string $name

Returns

mixed

removeService()

removeService(string  $name) : \Pop\Application

Remove a service

Parameters

string $name

Returns

\Pop\Application

on()

on(string  $name, mixed  $action, integer  $priority) : \Pop\Application

Attach an event. Default hook-points are:

app.init app.route.pre app.dispatch.pre app.dispatch.post app.error

Parameters

string $name
mixed $action
integer $priority

Returns

\Pop\Application

off()

off(string  $name, mixed  $action) : \Pop\Application

Detach an event. Default hook-points are:

app.init app.route.pre app.dispatch.pre app.dispatch.post app.error

Parameters

string $name
mixed $action

Returns

\Pop\Application

trigger()

trigger(string  $name, array  $args = array()) : \Pop\Application

Trigger an event

Parameters

string $name
array $args

Returns

\Pop\Application

run()

run(boolean  $exit = true) : void

Run the application.

Parameters

boolean $exit

__set()

__set(string  $name, mixed  $value) : \Pop\Application

Set a pre-designated value in the application object

Parameters

string $name
mixed $value

Returns

\Pop\Application

__get()

__get(string  $name) : mixed

Get a pre-designated value from the application object

Parameters

string $name

Returns

mixed

__isset()

__isset(string  $name) : boolean

Determine if a pre-designated value in the application object exists

Parameters

string $name

Returns

boolean

__unset()

__unset(string  $name) : \Pop\Application

Unset a pre-designated value in the application object

Parameters

string $name

Returns

\Pop\Application

offsetSet()

offsetSet(string  $offset, mixed  $value) : \Pop\Application

Set a pre-designated value in the application object

Parameters

string $offset
mixed $value

Returns

\Pop\Application

offsetGet()

offsetGet(string  $offset) : mixed

Get a pre-designated value from the application object

Parameters

string $offset

Returns

mixed

offsetExists()

offsetExists(string  $offset) : boolean

Determine if a pre-designated value in the application object exists

Parameters

string $offset

Returns

boolean

offsetUnset()

offsetUnset(string  $offset) : \Pop\Application

Unset a pre-designated value in the application object

Parameters

string $offset

Returns

\Pop\Application

get()

get(string  $route, mixed  $controller) : \Popcorn\Pop

Add a GET route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

head()

head(string  $route, mixed  $controller) : \Popcorn\Pop

Add a HEAD route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

post()

post(string  $route, mixed  $controller) : \Popcorn\Pop

Add a POST route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

put()

put(string  $route, mixed  $controller) : \Popcorn\Pop

Add a PUT route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

delete()

delete(string  $route, mixed  $controller) : \Popcorn\Pop

Add a DELETE route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

trace()

trace(string  $route, mixed  $controller) : \Popcorn\Pop

Add a TRACE route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

options()

options(string  $route, mixed  $controller) : \Popcorn\Pop

Add an OPTIONS route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

connect()

connect(string  $route, mixed  $controller) : \Popcorn\Pop

Add a CONNECT route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

patch()

patch(string  $route, mixed  $controller) : \Popcorn\Pop

Add a PATCH route

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

setRoute()

setRoute(string  $method, string  $route, mixed  $controller) : \Popcorn\Pop

Add a route

Parameters

string $method
string $route
mixed $controller

Throws

\Popcorn\Exception

Returns

\Popcorn\Pop

setRoutes()

setRoutes(array|string  $methods, string  $route, mixed  $controller) : \Popcorn\Pop

Add multiple routes

Parameters

array|string $methods
string $route
mixed $controller

Throws

\Popcorn\Exception

Returns

\Popcorn\Pop

addToAll()

addToAll(string  $route, mixed  $controller) : \Popcorn\Pop

Add to all methods

Parameters

string $route
mixed $controller

Returns

\Popcorn\Pop

getRoutes()

getRoutes(string  $method = null) : array

Method to get all routes

Parameters

string $method

Throws

\Popcorn\Exception

Returns

array

getRoute()

getRoute(string  $method, string  $route) : mixed

Method to get a route by method

Parameters

string $method
string $route

Returns

mixed

hasRoute()

hasRoute(string  $method, string  $route) : boolean

Method to determine if the application has a route

Parameters

string $method
string $route

Returns

boolean

isAllowed()

isAllowed(string  $route) : boolean

Determine if the route is allowed on for the method

Parameters

string $route

Returns

boolean