RdbAdmin Module

BaseController
in package

AbstractYes

BasedController class.

Tags
since
0.1

Table of Contents

Properties

$Container  : Container
$Db  : Db
$httpAcceptContentTypes  : array<string|int, mixed>
$Modules  : Modules
$Views  : Views

Methods

__construct()  : mixed
Based controller.
determineAcceptContentType()  : string
Determine HTTP accept content-type.
responseAcceptType()  : string
Response the `$output` content by `accept` type in request header.
responseJson()  : string
Set application/json header and return json encoded.
responseNoCache()  : mixed
Send no cache headers.
responseXml()  : string
Set application/xml header and return XML converted from array.

Properties

$httpAcceptContentTypes

protected array<string|int, mixed> $httpAcceptContentTypes

The HTTP accept content types. Sorted by quality values. This property can access after called responseAcceptType() method.

Tags
since
1.1.1

Methods

determineAcceptContentType()

Determine HTTP accept content-type.

protected determineAcceptContentType() : string
Tags
todo

[rdb] Remove this method (determineAcceptContentType) in v2.0

deprecated

since v1.1.3 Use this method from Input class instead.

link

Reference about quality values (xxx/xx;q=0.8 - for example).

since
1.1.1
Return values
string

Return determined content type.

responseAcceptType()

Response the `$output` content by `accept` type in request header.

protected responseAcceptType(mixed $output) : string

This method can detect accept in request header and response to certain content type automatically.

Parameters
$output : mixed

The content will be response. If this is array and accept is JSON or XML then it will automatically converted.

Return values
string

Return content type header and $output body.

responseJson()

Set application/json header and return json encoded.

protected responseJson(mixed $output) : string
Parameters
$output : mixed

The content will be json encode.

Return values
string

Return json encoded string.

responseNoCache()

Send no cache headers.

protected responseNoCache() : mixed

This should be called before response body. It is very useful with redirect to prevent redirect cached.

responseXml()

Set application/xml header and return XML converted from array.

protected responseXml(mixed $output) : string
Parameters
$output : mixed

The content will be XML. Recommended type is array.

Return values
string

Return XML converted content from $output array.


        
On this page

Search results