class AbstractWebApplication extends AbstractApplication (View source)

Application for Web HTTP foundation.

Methods

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

Class constructor.

void
close(integer|string $message)

Method to close the application.

mixed
execute()

Execute the application.

mixed
get(string $key, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

LoggerInterface
getLogger()

Get the logger.

mixed
set(string $key, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

setConfiguration(Structure $config)

Sets the configuration for the application.

setLogger(LoggerInterface $logger)

Set the logger.

mixed
__get($name)

is utilized for reading data from inaccessible members.

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

Method as the Psr7 WebHttpServer handler.

string
__toString()

Magic method to render output.

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

Redirect to another URL.

getEnvironment()

Method to get property Environment

setEnvironment(WebEnvironment $environment)

Method to set property environment

callable
getFinalHandler()

Method to get property FinalHandler

setFinalHandler(callable $finalHandler)

Method to set property finalHandler

boolean
checkHeadersSent()

Method to check to see if headers have already been sent.

getServer()

Method to get property Server

setServer(WebHttpServer $server)

Method to set property server

ServerRequestInterface
getRequest()

Method to get property Request

getUri()

Method to get property Uri

getBrowser()

Method to get property Browser

getPlatform()

Method to get property Platform

Details

at line line 88
__construct(ServerRequestInterface $request = null, Structure $config = null, WebEnvironment $environment = null)

Class constructor.

Parameters

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

void close(integer|string $message)

Method to close the application.

Parameters

integer|string $message The exit code (optional; default is 0).

Return Value

void

at line line 112
mixed execute()

Execute the application.

Return Value

mixed

mixed get(string $key, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

Parameters

string $key The name of the property.
mixed $default The default value (optional) if none is set.

Return Value

mixed The value of the configuration.

LoggerInterface getLogger()

Get the logger.

Return Value

LoggerInterface

mixed set(string $key, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $key The name of the property.
mixed $value The value of the property to set (optional).

Return Value

mixed Previous value of the property

AbstractApplication setConfiguration(Structure $config)

Sets the configuration for the application.

Parameters

Structure $config A structure object holding the configuration.

Return Value

AbstractApplication Returns itself to support chaining.

AbstractApplication setLogger(LoggerInterface $logger)

Set the logger.

Parameters

LoggerInterface $logger The logger.

Return Value

AbstractApplication Returns itself to support chaining.

at line line 403
mixed __get($name)

is utilized for reading data from inaccessible members.

Parameters

$name string

Return Value

mixed

at line line 156
abstract ResponseInterface dispatch(ServerRequestInterface $request, ResponseInterface $response, callable $next = 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 $next The next handler to support middleware pattern.

Return Value

ResponseInterface The returned response object.

at line line 165
string __toString()

Magic method to render output.

Return Value

string Rendered string.

at line line 188
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 256
WebEnvironment getEnvironment()

Method to get property Environment

Return Value

WebEnvironment

at line line 270
AbstractWebApplication setEnvironment(WebEnvironment $environment)

Method to set property environment

Parameters

WebEnvironment $environment

Return Value

AbstractWebApplication Return self to support chaining.

at line line 284
callable getFinalHandler()

Method to get property FinalHandler

Return Value

callable

at line line 298
AbstractWebApplication setFinalHandler(callable $finalHandler)

Method to set property finalHandler

Parameters

callable $finalHandler

Return Value

AbstractWebApplication Return self to support chaining.

at line line 315
boolean checkHeadersSent()

Method to check to see if headers have already been sent.

We wrap headers_sent() function with this method for testing reason.

Return Value

boolean True if the headers have already been sent.

See also

headers_sent()

at line line 327
WebHttpServer getServer()

Method to get property Server

Return Value

WebHttpServer

at line line 341
AbstractWebApplication setServer(WebHttpServer $server)

Method to set property server

Parameters

WebHttpServer $server

Return Value

AbstractWebApplication Return self to support chaining.

at line line 355
ServerRequestInterface getRequest()

Method to get property Request

Return Value

ServerRequestInterface

at line line 367
UriData getUri()

Method to get property Uri

Return Value

UriData

at line line 379
Browser getBrowser()

Method to get property Browser

Return Value

Browser

at line line 391
Platform getPlatform()

Method to get property Platform

Return Value

Platform