class WebApplication extends AbstractWebApplication implements WindwalkerApplicationInterface, DispatcherAwareInterface, ContainerAwareInterface (View source)

The WebApplication class.

Traits

The main Windwalker instantiate class.
The BootableTrait class.
DispatcherAwareTrait
ContainerAwareTrait

Methods

string
getName()

getName

Structure
getConfig()

getConfig

void
boot()

boot

getPackage(string $name = null)

getPackage

addPackage(string $name, AbstractPackage $package)

addPackage

boolean
isConsole()

isConsole

boolean
isWeb()

isWeb

__construct(ServerRequestInterface $request = null, Config $config = null, WebEnvironment $environment = null)

Class constructor.

ResponseInterface
execute()

Execute the application.

ResponseInterface
dispatch(ServerRequestInterface $request, ResponseInterface $response, callable $finalHandler = null)

Method as the Psr7 WebHttpServer handler.

getRouter(bool $new = false)

getRouter

bootRouting(bool $refresh = false)

bootRouting

setCurrentPackage(string|AbstractPackage $package)

setCurrentPackage

setTask(string|AbstractPackage $package, string|AbstractController $controller)

setTask

Psr7ChainBuilder
getMiddlewareChain()

getMiddlewareChain

PriorityQueue
getMiddlewares()

Method to get property Middlewares

setMiddlewares(PriorityQueue $middlewares)

Method to set property middlewares

addMiddleware(callable|Psr7InvokableInterface $middleware, int $priority = PriorityQueue::NORMAL)

addMiddleware

addMessage(string|array $messages, string $type = 'info')

addMessage

clearMessages()

clearMessage

getLogger()

Get the logger.

void
redirect(string $url, boolean|int $code = 303)

Redirect to another URL.

string
getMode()

Method to get property Mode

setMode(string $mode)

Method to set property mode

mixed
__get($name)

is utilized for reading data from inaccessible members.

Details

string getName()

getName

Return Value

string

Structure getConfig()

getConfig

Return Value

Structure

void boot()

boot

Return Value

void

AbstractPackage getPackage(string $name = null)

getPackage

Parameters

string $name

Return Value

AbstractPackage

WindwalkerTrait addPackage(string $name, AbstractPackage $package)

addPackage

Parameters

string $name
AbstractPackage $package

Return Value

WindwalkerTrait

boolean isConsole()

isConsole

Return Value

boolean

boolean isWeb()

isWeb

Return Value

boolean

at line line 113
__construct(ServerRequestInterface $request = null, Config $config = null, WebEnvironment $environment = null)

Class constructor.

Parameters

ServerRequestInterface $request An optional argument to provide dependency injection for the Http request object.
Config $config An optional argument to provide dependency injection for the application's config object.
WebEnvironment $environment An optional argument to provide dependency injection for the application's environment object.

at line line 150
ResponseInterface execute()

Execute the application.

Return Value

ResponseInterface

at line line 212
ResponseInterface dispatch(ServerRequestInterface $request, ResponseInterface $response, callable $finalHandler = null)

Method as the Psr7 WebHttpServer handler.

Parameters

ServerRequestInterface $request The Psr7 ServerRequest to get request params.
ResponseInterface $response The Psr7 Response interface to prepare respond data.
callable $finalHandler The next handler to support middleware pattern.

Return Value

ResponseInterface The returned response object.

at line line 232
MainRouter getRouter(bool $new = false)

getRouter

Parameters

bool $new

Return Value

MainRouter

at line line 256
WebApplication bootRouting(bool $refresh = false)

bootRouting

Parameters

bool $refresh

Return Value

WebApplication

at line line 270
WebApplication setCurrentPackage(string|AbstractPackage $package)

setCurrentPackage

Parameters

string|AbstractPackage $package

Return Value

WebApplication

at line line 290
WebApplication setTask(string|AbstractPackage $package, string|AbstractController $controller)

setTask

Parameters

string|AbstractPackage $package
string|AbstractController $controller

Return Value

WebApplication

at line line 326
Psr7ChainBuilder getMiddlewareChain()

getMiddlewareChain

Return Value

Psr7ChainBuilder

at line line 358
PriorityQueue getMiddlewares()

Method to get property Middlewares

Return Value

PriorityQueue

at line line 375
WebApplication setMiddlewares(PriorityQueue $middlewares)

Method to set property middlewares

Parameters

PriorityQueue $middlewares

Return Value

WebApplication Return self to support chaining.

at line line 390
WebApplication addMiddleware(callable|Psr7InvokableInterface $middleware, int $priority = PriorityQueue::NORMAL)

addMiddleware

Parameters

callable|Psr7InvokableInterface $middleware
int $priority

Return Value

WebApplication

at line line 405
WindwalkerApplicationInterface addMessage(string|array $messages, string $type = 'info')

addMessage

Parameters

string|array $messages
string $type

Return Value

WindwalkerApplicationInterface

at line line 417
WebApplication clearMessages()

clearMessage

Return Value

WebApplication

at line line 431
LoggerManager getLogger()

Get the logger.

Return Value

LoggerManager

at line line 450
void redirect(string $url, boolean|int $code = 303)

Redirect to another URL.

If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently" or "303 See Other" code in the header pointing to the new location. If the headers have already been sent this will be accomplished using a JavaScript statement.

Parameters

string $url The URL to redirect to. Can only be http/https URL
boolean|int $code True if the page is 301 Permanently Moved, otherwise 303 See Other is assumed.

Return Value

void

at line line 466
string getMode()

Method to get property Mode

Return Value

string

at line line 478
WebApplication setMode(string $mode)

Method to set property mode

Parameters

string $mode

Return Value

WebApplication Return self to support chaining.

at line line 492
mixed __get($name)

is utilized for reading data from inaccessible members.

Parameters

$name string

Return Value

mixed