ResponseMaker

Response Maker Trait Stores attributes the can be used to prepare a response from the server.

 trait System\Traits\ResponseMaker

Properties

protected $responseHeaderBag : Symfony\Component\HttpFoundation\ResponseHeaderBag

protected $responseOverride : mixed

Override the standard controller response.

protected $statusCode : int

Response status code

Methods

public getResponseHeaders () : Symfony\Component\HttpFoundation\ResponseHeaderBag | null

Get the header response bag

Returns
Symfony\Component\HttpFoundation\ResponseHeaderBag | null

public getStatusCode () : int

Returns the status code for the current web response.

Returns
int

Status code

public makeResponse (mixed $contents) : mixed

Prepares a response that considers overrides and custom responses.

Parameters
Property Description
$contents
mixed
Returns
mixed

public setResponse (mixed $response) : $this

Sets the response for the current page request cycle, this value takes priority over the standard response prepared by the controller.

Parameters
Property Description
$response
mixed

Response object or string

Returns
$this

public setResponseCookie (Symfony\Component\HttpFoundation\Cookie | mixed $cookie) : $this

Add a cookie to the response.

Parameters
Property Description
$cookie
Symfony\Component\HttpFoundation\Cookie | mixed
Returns
$this

public setResponseHeader (string $key, array | string $values, boolean $replace = true) : $this

Set a header on the Response.

Parameters
Property Description
$key
string
$values
array | string
$replace
boolean
Returns
$this

public setStatusCode (int $code) : $this

Sets the status code for the current web response.

Parameters
Property Description
$code
int

Status code

Returns
$this
Copyright © 2024 Winter CMS