\FW\View\Standard\HelpersJsonHelper

Json view implementation of the view module

Summary

Methods
Properties
Constants
__construct()
add()
get()
set()
has()
clear()
toString()
render()
getContentType()
getData()
No public properties found
No constants found
serializeObject()
$data
N/A
No private methods found
No private properties found
N/A

Properties

$data

$data : array

Array of data to render

Type

array

Methods

__construct()

__construct() 

Constructs the view module

add()

add(mixed  $object, string  $key = '', boolean  $recur = true) 

Adds stuff to render

Parameters

mixed $object

array or object to add

string $key

key to add $object at

boolean $recur

whether or not $object is a two-dimensional array

get()

get(string  $key) : mixed

Gets a variable that will be rendered

Parameters

string $key

variable to get

Returns

mixed —

variable gotten

set()

set(string  $key, mixed  $value) : \FW\View\Standard\Helpers\JsonHelper

Sets a value to the data array

Parameters

string $key

key to set

mixed $value

value to set

Returns

\FW\View\Standard\Helpers\JsonHelper

$this

has()

has(string  $key) : boolean

If the render data has a key

Parameters

string $key

key to check

Returns

boolean —

if the data contains the key

clear()

clear() : \FW\View\Standard\Helpers\JsonView

Clears the data array

Returns

\FW\View\Standard\Helpers\JsonView —

this object

toString()

toString(boolean  $forceObject = false) : string

Renders the data and returns it

Parameters

boolean $forceObject

whether or not to force json object behavior

Returns

string —

rendered json data as string

render()

render(boolean  $forceObject = false) 

Renders the data

Parameters

boolean $forceObject

whether or not the force json object behavior

getContentType()

getContentType() : string

Returns the content type

Returns

string —

content-type

getData()

getData() 

Function used in unit testing to get data

serializeObject()

serializeObject(mixed  $object) : array

Serializes an object

Parameters

mixed $object

Returns

array —

the serialized object