Pop
extends Application
in package
This is the main class for the Popcorn Micro-Framework.
Tags
Table of Contents
- $config : mixed
- Application config
- $autoloader : mixed
- Autoloader
- $config : mixed
- Application config
- $events : Manager
- Event manager
- $modules : Manager
- Module manager
- $router : Router
- Application router
- $routes : array<string|int, mixed>
- Routes array
- $services : Locator
- Service locator
- __call() : void
- Magic method to check for a custom method
- __construct() : mixed
- Constructor
- __get() : mixed
- Get a pre-designated value from the application object
- __isset() : bool
- Determine if a pre-designated value in the application object exists
- __set() : Application
- Set a pre-designated value in the application object
- __unset() : Application
- Unset a pre-designated value in the application object
- addConfigValue() : AbstractApplication
- Add new value to config
- addCustomMethod() : Pop
- Add a custom method
- addRoute() : Application
- Add a route
- addRoutes() : Application
- Add routes
- addToAll() : Pop
- Add to all methods
- any() : Pop
- Add to any and all methods (alias method to addToAll)
- autoloader() : mixed
- Get the autoloader object
- bootstrap() : 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
- config() : mixed
- Access application config
- connect() : Pop
- Add a CONNECT route
- delete() : Pop
- Add a DELETE route
- deleteConfigValue() : AbstractApplication
- Replace existing value in config
- events() : Manager
- Get the event manager
- get() : Pop
- Add a GET route
- getRoute() : mixed
- Method to get a route by method
- getRoutes() : array<string|int, mixed>
- Method to get all routes
- getService() : mixed
- Get a service
- hasCustomMethod() : bool
- Has a custom method
- hasRoute() : bool
- Method to determine if the application has a route
- head() : Pop
- Add a HEAD route
- init() : Application
- Initialize the application
- isAllowed() : bool
- Determine if the route is allowed on for the method
- isRegistered() : bool
- Determine whether a module is registered with the application object
- mergeConfig() : AbstractApplication
- Merge new or altered config values with the existing config values
- module() : ModuleInterface
- Access a module object
- modules() : Manager
- Access all application module configs
- off() : Application
- Detach an event. Default hook-points are:
- offsetExists() : bool
- Determine if a pre-designated value in the application object exists
- offsetGet() : mixed
- Get a pre-designated value from the application object
- offsetSet() : Application
- Set a pre-designated value in the application object
- offsetUnset() : Application
- Unset a pre-designated value in the application object
- on() : Application
- Attach an event. Default hook-points are:
- options() : Pop
- Add an OPTIONS route
- patch() : Pop
- Add a PATCH route
- post() : Pop
- Add a POST route
- put() : Pop
- Add a PUT route
- register() : Application
- Register a module with the module manager object
- registerAutoloader() : Application
- Register the autoloader object with the application
- registerConfig() : AbstractApplication
- Register a new configuration with the application
- registerEvents() : Application
- Register a new event manager object with the application
- registerModules() : Application
- Register a new module manager object with the application
- registerRouter() : Application
- Register a new router object with the application
- registerServices() : Application
- Register a new service locator object with the application
- removeService() : Application
- Remove a service
- router() : Router
- Access the application router
- run() : void
- Run the application.
- services() : Locator
- Get the service locator
- setRoute() : Pop
- Add a route
- setRoutes() : Pop
- Add multiple routes
- setService() : Application
- Set a service
- trace() : Pop
- Add a TRACE route
- trigger() : Application
- Trigger an event
- unregister() : Application
- Unregister a module with the module manager object
- updateConfigValue() : AbstractApplication
- Update existing value in config
Properties
$config
Application config
public
mixed
$config
mixed
$autoloader
Autoloader
protected
mixed
$autoloader
= null
$config
Application config
protected
mixed
$config
= null
$events
Event manager
protected
Manager
$events
= null
$modules
Module manager
protected
Manager
$modules
= null
$router
Application router
protected
Router
$router
= null
$routes
Routes array
protected
array<string|int, mixed>
$routes
= ['get' => [], 'head' => [], 'post' => [], 'put' => [], 'delete' => [], 'trace' => [], 'options' => [], 'connect' => [], 'patch' => []]
$services
Service locator
protected
Locator
$services
= null
Methods
__call()
Magic method to check for a custom method
public
__call(string $methodName, array<string|int, mixed> $arguments) : void
Parameters
- $methodName : string
- $arguments : array<string|int, mixed>
Tags
Return values
void —__construct()
Constructor
public
__construct() : mixed
Instantiate an application object
Optional parameters are a service locator instance, a router instance, an event manager instance or a configuration object or array
Return values
mixed —__get()
Get a pre-designated value from the application object
public
__get(string $name) : mixed
Parameters
- $name : string
Return values
mixed —__isset()
Determine if a pre-designated value in the application object exists
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool —__set()
Set a pre-designated value in the application object
public
__set(string $name, mixed $value) : Application
Parameters
- $name : string
- $value : mixed
Tags
Return values
Application —__unset()
Unset a pre-designated value in the application object
public
__unset(string $name) : Application
Parameters
- $name : string
Return values
Application —addConfigValue()
Add new value to config
public
addConfigValue(string $name, string $value) : AbstractApplication
Parameters
- $name : string
- $value : string
Return values
AbstractApplication —addCustomMethod()
Add a custom method
public
addCustomMethod(string $customMethod) : Pop
Parameters
- $customMethod : string
Return values
Pop —addRoute()
Add a route
public
addRoute(string $route, mixed $controller) : Application
Parameters
- $route : string
- $controller : mixed
Return values
Application —addRoutes()
Add routes
public
addRoutes(array<string|int, mixed> $routes) : Application
Parameters
- $routes : array<string|int, mixed>
Return values
Application —addToAll()
Add to all methods
public
addToAll(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —any()
Add to any and all methods (alias method to addToAll)
public
any(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —autoloader()
Get the autoloader object
public
autoloader() : mixed
Return values
mixed —bootstrap()
Bootstrap the application, creating the required objects if they haven't been created yet and registering with the autoloader, adding routes, services and events
public
bootstrap([mixed $autoloader = null ]) : Application
Parameters
- $autoloader : mixed = null
Tags
Return values
Application —config()
Access application config
public
config() : mixed
Return values
mixed —connect()
Add a CONNECT route
public
connect(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —delete()
Add a DELETE route
public
delete(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —deleteConfigValue()
Replace existing value in config
public
deleteConfigValue(string $name) : AbstractApplication
Parameters
- $name : string
Return values
AbstractApplication —events()
Get the event manager
public
events() : Manager
Return values
Manager —get()
Add a GET route
public
get(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —getRoute()
Method to get a route by method
public
getRoute(string $method, string $route) : mixed
Parameters
- $method : string
- $route : string
Return values
mixed —getRoutes()
Method to get all routes
public
getRoutes([string $method = null ]) : array<string|int, mixed>
Parameters
- $method : string = null
Tags
Return values
array<string|int, mixed> —getService()
Get a service
public
getService(string $name) : mixed
Parameters
- $name : string
Tags
Return values
mixed —hasCustomMethod()
Has a custom method
public
hasCustomMethod(string $customMethod) : bool
Parameters
- $customMethod : string
Return values
bool —hasRoute()
Method to determine if the application has a route
public
hasRoute(string $method, string $route) : bool
Parameters
- $method : string
- $route : string
Return values
bool —head()
Add a HEAD route
public
head(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —init()
Initialize the application
public
init() : Application
Tags
Return values
Application —isAllowed()
Determine if the route is allowed on for the method
public
isAllowed(string $route) : bool
Parameters
- $route : string
Return values
bool —isRegistered()
Determine whether a module is registered with the application object
public
isRegistered(string $name) : bool
Parameters
- $name : string
Return values
bool —mergeConfig()
Merge new or altered config values with the existing config values
public
mergeConfig(mixed $config[, bool $preserve = false ]) : AbstractApplication
Parameters
- $config : mixed
- $preserve : bool = false
Tags
Return values
AbstractApplication —module()
Access a module object
public
module(string $name) : ModuleInterface
Parameters
- $name : string
Return values
ModuleInterface —modules()
Access all application module configs
public
modules() : Manager
Return values
Manager —off()
Detach an event. Default hook-points are:
public
off(string $name, mixed $action) : Application
app.init app.route.pre app.dispatch.pre app.dispatch.post app.error
Parameters
- $name : string
- $action : mixed
Return values
Application —offsetExists()
Determine if a pre-designated value in the application object exists
public
offsetExists(string $offset) : bool
Parameters
- $offset : string
Return values
bool —offsetGet()
Get a pre-designated value from the application object
public
offsetGet(string $offset) : mixed
Parameters
- $offset : string
Return values
mixed —offsetSet()
Set a pre-designated value in the application object
public
offsetSet(string $offset, mixed $value) : Application
Parameters
- $offset : string
- $value : mixed
Tags
Return values
Application —offsetUnset()
Unset a pre-designated value in the application object
public
offsetUnset(string $offset) : Application
Parameters
- $offset : string
Return values
Application —on()
Attach an event. Default hook-points are:
public
on(string $name, mixed $action, int $priority) : Application
app.init app.route.pre app.dispatch.pre app.dispatch.post app.error
Parameters
- $name : string
- $action : mixed
- $priority : int
Return values
Application —options()
Add an OPTIONS route
public
options(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —patch()
Add a PATCH route
public
patch(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —post()
Add a POST route
public
post(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —put()
Add a PUT route
public
put(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —register()
Register a module with the module manager object
public
register(mixed $module[, string $name = null ]) : Application
Parameters
- $module : mixed
- $name : string = null
Tags
Return values
Application —registerAutoloader()
Register the autoloader object with the application
public
registerAutoloader(mixed $autoloader) : Application
Parameters
- $autoloader : mixed
Tags
Return values
Application —registerConfig()
Register a new configuration with the application
public
registerConfig(mixed $config) : AbstractApplication
Parameters
- $config : mixed
Tags
Return values
AbstractApplication —registerEvents()
Register a new event manager object with the application
public
registerEvents(Manager $events) : Application
Parameters
- $events : Manager
Return values
Application —registerModules()
Register a new module manager object with the application
public
registerModules(Manager $modules) : Application
Parameters
- $modules : Manager
Return values
Application —registerRouter()
Register a new router object with the application
public
registerRouter(Router $router) : Application
Parameters
- $router : Router
Return values
Application —registerServices()
Register a new service locator object with the application
public
registerServices(Locator $services) : Application
Parameters
- $services : Locator
Return values
Application —removeService()
Remove a service
public
removeService(string $name) : Application
Parameters
- $name : string
Return values
Application —router()
Access the application router
public
router() : Router
Return values
Router —run()
Run the application.
public
run([bool $exit = true ][, string $forceRoute = null ]) : void
Parameters
- $exit : bool = true
- $forceRoute : string = null
Tags
Return values
void —services()
Get the service locator
public
services() : Locator
Return values
Locator —setRoute()
Add a route
public
setRoute(string $method, string $route, mixed $controller) : Pop
Parameters
- $method : string
- $route : string
- $controller : mixed
Tags
Return values
Pop —setRoutes()
Add multiple routes
public
setRoutes(array<string|int, mixed>|string $methods, string $route, mixed $controller) : Pop
Parameters
- $methods : array<string|int, mixed>|string
- $route : string
- $controller : mixed
Tags
Return values
Pop —setService()
Set a service
public
setService(string $name, mixed $service) : Application
Parameters
- $name : string
- $service : mixed
Tags
Return values
Application —trace()
Add a TRACE route
public
trace(string $route, mixed $controller) : Pop
Parameters
- $route : string
- $controller : mixed
Return values
Pop —trigger()
Trigger an event
public
trigger(string $name[, array<string|int, mixed> $args = [] ]) : Application
Parameters
- $name : string
- $args : array<string|int, mixed> = []
Return values
Application —unregister()
Unregister a module with the module manager object
public
unregister(string $name) : Application
Parameters
- $name : string
Return values
Application —updateConfigValue()
Update existing value in config
public
updateConfigValue(string $name, string $value) : AbstractApplication
Parameters
- $name : string
- $value : string