Response
in package
Web service response class.
Table of Contents
- $acceptableHeaders : array<string|int, string>
- Access control allow headers.
- $acceptableMethods : array<string|int, string>
- Access control allow methods.
- $body : mixed
- $file : File
- File instance.
- $headers : array<string|int, mixed>
- Headers.
- $instance : mixed
- $reasonPhrase : string
- $request : Request
- Request instance.
- $responseType : string
- $status : int
- addHeader() : void
- Add header.
- debugResponse() : void
- Debug response function.
- encodeJson() : string
- Encode json data output.
- encodeXml() : mixed
- encryptData() : mixed
- getInstance() : self
- Get instance.
- send() : mixed
- setAcceptableHeaders() : void
- Set acceptable headers.
- setAcceptableMethods() : void
- Set acceptable methods.
- setBody() : void
- Set body data.
- setFile() : void
- Set file instance.
- setReasonPhrase() : void
- Set reason phrase.
- setRequest() : void
- Set request.
- setStatus() : void
- Set status code.
- toXml() : mixed
- getReasonPhrase() : string
- Get reason phrase.
Properties
$acceptableHeaders
Access control allow headers.
protected
array<string|int, string>
$acceptableHeaders
= ['x-api-key', 'x-encrypted', 'x-token']
$acceptableMethods
Access control allow methods.
protected
array<string|int, string>
$acceptableMethods
= []
$body
protected
mixed
$body
$file
File instance.
protected
File
$file
$headers
Headers.
protected
array<string|int, mixed>
$headers
= []
$instance
protected
static mixed
$instance
= false
$reasonPhrase
protected
string
$reasonPhrase
Reason phrase.
$request
Request instance.
protected
Request
$request
$responseType
protected
string
$responseType
Response data type.
$status
protected
int
$status
= 200
Response status code.
Methods
addHeader()
Add header.
public
addHeader(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
Return values
void —debugResponse()
Debug response function.
public
debugResponse() : void
Return values
void —encodeJson()
Encode json data output.
public
encodeJson(array<string|int, mixed> $responseData) : string
Parameters
- $responseData : array<string|int, mixed>
Return values
string —encodeXml()
public
encodeXml(mixed $responseData) : mixed
Parameters
- $responseData : mixed
Return values
mixed —encryptData()
public
encryptData(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —getInstance()
Get instance.
public
static getInstance() : self
Return values
self —send()
public
send() : mixed
Return values
mixed —setAcceptableHeaders()
Set acceptable headers.
public
setAcceptableHeaders(array<string|int, string> $headers) : void
Parameters
- $headers : array<string|int, string>
Return values
void —setAcceptableMethods()
Set acceptable methods.
public
setAcceptableMethods(array<string|int, string> $methods) : void
Parameters
- $methods : array<string|int, string>
Return values
void —setBody()
Set body data.
public
setBody(array<string|int, mixed> $body) : void
Parameters
- $body : array<string|int, mixed>
Return values
void —setFile()
Set file instance.
public
setFile(File $file) : void
Parameters
- $file : File
Return values
void —setReasonPhrase()
Set reason phrase.
public
setReasonPhrase(string $reasonPhrase) : void
Parameters
- $reasonPhrase : string
Return values
void —setRequest()
Set request.
public
setRequest(Request $request) : void
Parameters
- $request : Request
Return values
void —setStatus()
Set status code.
public
setStatus(int $status) : void
Parameters
- $status : int
Return values
void —toXml()
public
toXml(mixed $data, SimpleXMLElement &$xmlData) : mixed
Parameters
- $data : mixed
- $xmlData : SimpleXMLElement
Return values
mixed —getReasonPhrase()
Get reason phrase.
private
getReasonPhrase() : string