PHP Class Webiny\Component\Rest\Response\CallbackResult

Inheritance: use trait Webiny\Component\Http\HttpTrait, use trait Webiny\Component\StdLib\StdLibTrait
显示文件 Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
addDebugMessage ( string | array $message ) Adds a debug message to the debug output section.
addErrorMessage ( array $error ) Appends an error entry to the output.
attachDebugHeader ( string $name, string $value, boolean $ignoreEnv = false ) Adds a debug header information.
getData ( ) : mixed Returns the data from the service response.
getError ( ) : boolean | array If there are errors, error report array is returned, otherwise false.
getOutput ( ) : array Returns the output in form of an array.
sendOutput ( ) Sends the output to browser.
setData ( mixed $data ) Sets the callback content data.
setEnvToDevelopment ( ) Sets environment flag to development.
setErrorResponse ( string $message, string $description = '', string $code = '' ) Adds a general error to the response.
setExpiresIn ( integer $expiresIn ) Sets the cache control expiration time.
setHeaderResponse ( integer $statusCode, string $message = '' ) Set response header status code and message.

Method Details

addDebugMessage() public method

Adds a debug message to the debug output section.
public addDebugMessage ( string | array $message )
$message string | array Debug message.

addErrorMessage() public method

Appends an error entry to the output.
public addErrorMessage ( array $error )
$error array Error data

attachDebugHeader() public method

Adds a debug header information.
public attachDebugHeader ( string $name, string $value, boolean $ignoreEnv = false )
$name string Header name.
$value string Header value.
$ignoreEnv boolean Headers will be added only if we are in development mode, unless you set this to true.

getData() public method

Returns the data from the service response.
public getData ( ) : mixed
return mixed

getError() public method

If there are errors, error report array is returned, otherwise false.
public getError ( ) : boolean | array
return boolean | array

getOutput() public method

Returns the output in form of an array.
public getOutput ( ) : array
return array

sendOutput() public method

Sends the output to browser.
public sendOutput ( )

setData() public method

Sets the callback content data.
public setData ( mixed $data )
$data mixed Data that will be set into output 'data' field.

setEnvToDevelopment() public method

Sets environment flag to development.
public setEnvToDevelopment ( )

setErrorResponse() public method

Adds a general error to the response.
public setErrorResponse ( string $message, string $description = '', string $code = '' )
$message string Error message.
$description string Error description.
$code string Error code.

setExpiresIn() public method

Sets the cache control expiration time.
public setExpiresIn ( integer $expiresIn )
$expiresIn integer

setHeaderResponse() public method

Set response header status code and message.
public setHeaderResponse ( integer $statusCode, string $message = '' )
$statusCode integer Response status code.
$message string Response message.