\MocaBonita\toolsMbResponse

Main class of the MocaBonita Response

Summary

Methods
Properties
Constants
getMbRequest()
setMbRequest()
getMbAudit()
setMbAudit()
isBuffer()
setBuffer()
setContent()
sendContent()
redirect()
downloadFile()
disableCache()
create()
adminNotice()
adminNoticeTemplate()
sendHeaders()
No public properties found
No constants found
ajaxContent()
htmlContent()
$mbRequest
$mbAudit
$buffer
N/A
No private methods found
No private properties found
N/A

Properties

$buffer

$buffer : boolean

Stores if controller is buffer

Type

boolean

Methods

isBuffer()

isBuffer() : boolean

Returns

boolean

setContent()

setContent(mixed  $content) : \MocaBonita\tools\MbResponse

Set the content on the response.

Parameters

mixed $content

Returns

\MocaBonita\tools\MbResponse

sendContent()

sendContent() 

Sends content for the current web response.

redirect()

redirect(string  $url, array  $params = array(), integer  $status = 302) : boolean

Redirect a page

Parameters

string $url
array $params
integer $status

Returns

boolean

downloadFile()

downloadFile(\SplFileInfo  $content) : boolean

Download file

Parameters

\SplFileInfo $content

Throws

\MocaBonita\tools\MbException

Returns

boolean

disableCache()

disableCache() : void

Disable any type of page cache during access

create()

create(mixed  $content = '', integer  $status = 200, array  $headers = array()) : \MocaBonita\tools\MbResponse

Factory method for chainability.

Example:

return Response::create($body, 200)
    ->setSharedMaxAge(300);

Parameters

mixed $content

The response content, see setContent()

integer $status

The response status code

array $headers

An array of response headers

Returns

\MocaBonita\tools\MbResponse

adminNotice()

adminNotice(string  $message, string  $type = 'success') 

Post an admin notice on the dashboard

Parameters

string $message
string $type

adminNoticeTemplate()

adminNoticeTemplate(string  $message, string  $type = 'error') : string

Get admin notice structure template

Parameters

string $message
string $type

Returns

string

sendHeaders()

sendHeaders() : \Symfony\Component\HttpFoundation\Response

Returns

\Symfony\Component\HttpFoundation\Response

ajaxContent()

ajaxContent(array|\Exception  $content) : array<mixed,array>

Format content for json output

Parameters

array|\Exception $content

Returns

array<mixed,array>

htmlContent()

htmlContent(  $content) : void

Format content for html output

Parameters

$content