class HTTPApplication implements Application (View source)

Traits

Adds middleware support to an object.

Properties

protected HTTPMiddleware[] $middlewares from  HTTPMiddlewareAware
protected Kernel $kernel

Methods

public
getMiddlewares()

No description

public
$this
setMiddlewares(HTTPMiddleware[] $middlewares)

No description

public
$this
addMiddleware(HTTPMiddleware $middleware)

No description

protected
callMiddleware(HTTPRequest $request, callable $last)

Call middleware

public
__construct(Kernel $kernel)

Initialize the application with a kernel instance

public
$this
setFlushDiscoverer(FlushDiscoverer $discoverer)

Override the default flush discovery

public
getFlushDiscoverer(HTTPRequest $request)

Returns the current flush discoverer

protected
string
getEnvironmentType()

Return the current environment type (dev, test or live) Only checks Kernel and Server ENV as we don't have sessions initialized yet

public
getKernel()

Get the kernel for this application

public
handle(HTTPRequest $request)

Handle the given HTTP request

public
execute(HTTPRequest $request, callable $callback, bool $flush = false)

Safely boot the application and execute the given main action

Details

HTTPMiddleware[] getMiddlewares()

No description

Return Value

HTTPMiddleware[]

$this setMiddlewares(HTTPMiddleware[] $middlewares)

No description

Parameters

HTTPMiddleware[] $middlewares

Return Value

$this

$this addMiddleware(HTTPMiddleware $middleware)

No description

Parameters

HTTPMiddleware $middleware

Return Value

$this

protected HTTPResponse callMiddleware(HTTPRequest $request, callable $last)

Call middleware

Parameters

HTTPRequest $request

The request to pass to the middlewares and callback

callable $last

The callback to call after all middlewares

Return Value

HTTPResponse

__construct(Kernel $kernel)

Initialize the application with a kernel instance

Parameters

Kernel $kernel

$this setFlushDiscoverer(FlushDiscoverer $discoverer)

Override the default flush discovery

Parameters

FlushDiscoverer $discoverer

Return Value

$this

FlushDiscoverer getFlushDiscoverer(HTTPRequest $request)

Returns the current flush discoverer

Parameters

HTTPRequest $request

a request to probe for flush parameters

Return Value

FlushDiscoverer

protected string getEnvironmentType()

Return the current environment type (dev, test or live) Only checks Kernel and Server ENV as we don't have sessions initialized yet

Return Value

string

Kernel getKernel()

Get the kernel for this application

Return Value

Kernel

HTTPResponse handle(HTTPRequest $request)

Handle the given HTTP request

Parameters

HTTPRequest $request

Return Value

HTTPResponse

HTTPResponse execute(HTTPRequest $request, callable $callback, bool $flush = false)

Safely boot the application and execute the given main action

Parameters

HTTPRequest $request
callable $callback
bool $flush

Return Value

HTTPResponse