\response

Provides a standard to base all responses to be called with AJAX on

Summary

Methods
Properties
Constants
__construct()
__set()
__get()
__isset()
__unset()
http_response_code()
getJson()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$response
$http_response_code
N/A

Properties

$response

$response : 

The variable to keep the response in until output

Type

$http_response_code

$http_response_code : 

The variable to keep the HTTP response code in until output

Type

Methods

__construct()

__construct() 

Create a new instance

__set()

__set(string  $name, string  $value) 

Set a variable of the response

Parameters

string $name

The name of the variable to set

string $value

The (new) value for the variable

__get()

__get(string  $name) : mixed

Get a variable of the response

Parameters

string $name

The name of the variable to get

Returns

mixed —

The value of the variable

__isset()

__isset(string  $name) : boolean

Check if a variable of the response is set

Parameters

string $name

The name of the variable to check

Returns

boolean —

True if the variable exists, false otherwise

__unset()

__unset(string  $name) 

Unset a variable of the response

Parameters

string $name

The variable to unset

http_response_code()

http_response_code(integer  $code = null) : integer|boolean

Get or set the HTTP response code

If a parameter is provided, it is used as the new HTTP response code, and a bool is returned for success or failure. Otherwise, the current one is returned.

Parameters

integer $code

The new code

Returns

integer|boolean —

True on successful change, false on unsuccesful change, int when the current code is returned

getJson()

getJson() : string

Output the response in json

Returns

string —

The response in json format