class DefaultServer implements ServerInterface, ApplicationAwareInterface (View source)

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Properties

protected Application $app from  ApplicationAwareTrait
protected callable $dispatcher
protected StackInterface $stack

Methods

setApplication(Application $app)

Setter method for the application

__construct(DispatcherInterface $dispatcher, StackInterface $stack)

Server constructor.

setDispatcher(DispatcherInterface $dispatcher)

Set the dispatcher this server uses.

addMiddleware(MiddlewareInterface $middleware, int $priority = 10)

Add a middleware to the stack

removeMiddleware(MiddlewareInterface $middleware)

Remove a middleware from the stack

Response
handleRequest(Request $request)

Take a request and pass it through middleware, then return the response

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

__construct(DispatcherInterface $dispatcher, StackInterface $stack)

Server constructor.

Parameters

DispatcherInterface $dispatcher
StackInterface $stack

ServerInterface setDispatcher(DispatcherInterface $dispatcher)

Set the dispatcher this server uses.

A dispatcher is used to handle the final conversion from request to response function ($request, $response) : Response;

Parameters

DispatcherInterface $dispatcher

Return Value

ServerInterface

ServerInterface addMiddleware(MiddlewareInterface $middleware, int $priority = 10)

Add a middleware to the stack

Parameters

MiddlewareInterface $middleware
int $priority

Lower priority runs first

Return Value

ServerInterface

ServerInterface removeMiddleware(MiddlewareInterface $middleware)

Remove a middleware from the stack

Parameters

MiddlewareInterface $middleware

Return Value

ServerInterface

Response handleRequest(Request $request)

Take a request and pass it through middleware, then return the response

Parameters

Request $request

Return Value

Response