\FAA\ObjResponse

Summary

Methods
Properties
Constants
__construct()
Redirect()
CustomContentType()
GetRedirect()
Type()
SetErrorCode()
SetSuccess()
GetCode()
FilePath()
FileName()
SetAttachment()
AddHeader()
GetHeader()
Serialize()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$header
$redirect
$filepath
$filename
$content_type
$code
$type
N/A

Properties

$header

$header :array

List of additional header fields

Type

array

$redirect

$redirect :boolean

Is redirect

Type

boolean

$filepath

$filepath :string

File path for attachment

Type

string

$filename

$filename :string

File name for attachment

Type

string

$content_type

$content_type :string

Buffer for content type

Type

string

$code

$code :null

The http response codes

Type

null

$type

$type :integer

The response type

Type

integer

Methods

__construct()

__construct(boolean  $status = false,string  $message = "",mixed  $values = array(),mixed  $secondary = array())

Construct response construct a new instance of the response object

Parameters

boolean $status

The boolean state of the initialised status

string $message

The first message

mixed $values

The first values

mixed $secondary

The secondary values

Redirect()

Redirect(string|array  $path,boolean  $direct = false)

Set redirect

Redirect to this path. The url will be interpreted as internal link by default. To use external targets, set the second argument to true

Parameters

string|array $path

The absolute redirect path or an array with path and query arguments

boolean $direct

Set as direct response type

CustomContentType()

CustomContentType(): string|null

Get custom response type

Returns

string|null

GetRedirect()

GetRedirect(): boolean

Is a redirect?

Returns

boolean

Type()

Type(integer  $type = null,string  $value = null): integer|null

Expose type getter / setter

Provide an interface to the local response content type

The type is one of: FAA_RESPONSE_TYPE_JSON, FAA_RESPONSE_TYPE_HTML, FAA_RESPONSE_TYPE_ATTACHMENT, FAA_RESPONSE_TYPE_CORS, FAA_RESPONSE_TYPE_DIRECT_REDIRECT, FAA_RESPONSE_TYPE_XML, FAA_RESPONSE_TYPE_TXT, FAA_RESPONSE_TYPE_CUSTOM, FAA_RESPONSE_TYPE_ATTACHMENT_AUTO

Parameters

integer $type

The system response type

string $value

The system response content type as string

Returns

integer|null —

The system response type or void in setter mode

SetErrorCode()

SetErrorCode(integer  $code = 500,boolean  $status = false)

Set error response code

Parameters

integer $code

Http response code, should be of 400 - 599

boolean $status

Override status of this call

SetSuccess()

SetSuccess(integer  $code = 201,string  $path = null)

Set http success code

Can be used to set a paths for the next call as well Set the status of the instance to true

Parameters

integer $code

The response code, should be of 200 - 299

string $path

Can be set to a redirect path e.g. after POST witch created result

GetCode()

GetCode(): integer

Get the response code

Returns

integer

FilePath()

FilePath(): string

Get file path of attachment

Returns

string

FileName()

FileName(): string

Get the file name of attachment

Returns

string

SetAttachment()

SetAttachment(string  $path,string  $name,integer  $mode = FAA_RESPONSE_TYPE_ATTACHMENT): boolean

Send as file attachment

Set outbound parse mode to attachment. Query parameters and anchor parts will be stripped automatically

Parameters

string $path

The absolute file path

string $name

The file name

integer $mode

The file mime type handling option, either FAA_RESPONSE_TYPE_ATTACHMENT or, FAA_RESPONSE_TYPE_ATTACHMENT_AUTO

Returns

boolean

AddHeader()

AddHeader(array  $header)

set outbound header add a set of header to the local ones

Parameters

array $header

A list of header

GetHeader()

GetHeader(): array

get outbound header get a set of header to the local ones

Returns

array —

a list of header entries

Serialize()

Serialize(string  $language = null): array

Serialize Convert to regular array

Parameters

string $language

The target language or null

Returns

array