1.2.6. Header Callbacks

1.2.6.1. Setting

final public setHeaderCallbacks(array $callbacks) : static

Sets an array of callbacks to be invoked just before headers are sent by the Response, replacing any existing callbacks.

This method is similar to header_register_callback(), except that multiple callbacks may be registered with the Response.

Each value in the $callbacks array is expected to be a callable with the following signature:

function (Response $response) : void

The method is fluent, allowing you to chain a call to another Response method.

1.2.6.2. Adding

final public addHeaderCallback(callable $callback) : static

Appends one callback to the current array of header callbacks in the Response.

The $callback is expected to be a callable with the following signature:

function (Response $response) : void

The method is fluent, allowing you to chain a call to another Response method.

1.2.6.3. Getting

final public getHeaderCallbacks() : array

Returns the array of header callbacks in the Response.

1.2.6.4. Checking

final public hasHeaderCallbacks() : bool

Returns true if there are any header callbacks in the Response, false if not.

1.2.6.5. Removing

final public unsetHeaderCallbacks() : static

Removes all header callbacks from the Response.

The method is fluent, allowing you to chain a call to another Response method.