Avi documentation

Response
in package

Response class.

Tags
author

aviato-vasile

Table of Contents

Properties

$action  : mixed
$data  : mixed
$location  : mixed
$success  : mixed
$filter  : mixed
$log  : mixed
$type  : mixed
$default  : mixed
$defines  : mixed
$options  : mixed

Methods

__construct()  : mixed
The Constructor
action()  : mixed
Define/Return the response action
get()  : mixed
Return the response
getData()  : array<string|int, mixed>|null
Get the data response value
log()  : mixed
Add message to log
result()  : string
Return the result
success()  : bool
Set and get the Success value
type()  : mixed
Set the response type
logMessage()  : mixed
Generate a log from a message id
cleanupLog()  : void
Perform a log clean up, by deleting duplicates and ordering messages
clearLog()  : void
Clear the log - usefull in case of multiple object calls.
getMessage()  : string
Return the message text corresponding with message id
removeLogByMessageId()  : mixed
Remove log message by it's ID
validate()  : bool
Validate response object and create log message based on that
validityLog()  : mixed
Add or remove log on specified condition

Properties

$defines

private mixed $defines = ['action' => ['call', 'section', 'upload'], 'types' => ['array', 'html', 'json'], 'logs' => ['danger', 'debug', 'error', 'info', 'primary', 'success', 'warning'], 'messages' => [ // 100..199 - errors: 100 => 'Undefined action!', // 200..299 - warnings: 200 => 'Missing action!', 201 => 'Empty response!', 202 => 'Missing Upload Handler!', 203 => 'Missing Upload Handler object definition!', 222 => 'Missing Definition for this message id!', ]]

Methods

__construct()

The Constructor

public __construct([string $action = null ][, string $param = 'action' ]) : mixed
Parameters
$action : string = null

= the action to do...

$param : string = 'action'

= the parameter to request in case of action is missing, default value = 'action'

action()

Define/Return the response action

public action([string $action = null ]) : mixed
Parameters
$action : string = null

get()

Return the response

public get([mixed $clearLogAfterCall = true ]) : mixed
Parameters
$clearLogAfterCall : mixed = true
Return values
mixed

array json formated

getData()

Get the data response value

public getData([string $key = null ]) : array<string|int, mixed>|null
Parameters
$key : string = null
Return values
array<string|int, mixed>|null

log()

Add message to log

public log(string $message[, bool|string $type = false ][, int $id = 999 ]) : mixed
Parameters
$message : string
$type : bool|string = false
$id : int = 999

result()

Return the result

public result([bool $success = null ][, bool $returnOnly = false ]) : string
Parameters
$success : bool = null
$returnOnly : bool = false
Return values
string

success()

Set and get the Success value

public success([bool $success = null ]) : bool
Parameters
$success : bool = null
Return values
bool

type()

Set the response type

public type([mixed $type = null ]) : mixed
Parameters
$type : mixed = null

logMessage()

Generate a log from a message id

protected logMessage(int $messageId) : mixed
Parameters
$messageId : int

cleanupLog()

Perform a log clean up, by deleting duplicates and ordering messages

private cleanupLog() : void

clearLog()

Clear the log - usefull in case of multiple object calls.

private clearLog() : void

getMessage()

Return the message text corresponding with message id

private getMessage([int $messageId = 222 ]) : string
Parameters
$messageId : int = 222
Return values
string

removeLogByMessageId()

Remove log message by it's ID

private removeLogByMessageId(int $messageId) : mixed
Parameters
$messageId : int

validate()

Validate response object and create log message based on that

private validate() : bool
Return values
bool

validityLog()

Add or remove log on specified condition

private validityLog(bool $condition, int $logId) : mixed
Parameters
$condition : bool
$logId : int

        
On this page

Search results