Elgg  Version 1.11
Public Member Functions | Protected Attributes | List of all members
Elgg\Json\EmptyKeyEncoding Class Reference

Public Member Functions

 __construct ($empty_key= '')
 Constructor. More...
 
 getEmptyKey ()
 Get the key that represents an empty string key in JSON. More...
 
 decode ($json, $assoc=false, $depth=512, $options=0)
 Decode JSON while converting empty keys to a unique token. More...
 
 encode ($value, $options=0, $depth=512)
 Encode JSON while converting unique token keys to empty strings. More...
 

Protected Attributes

 $token
 

Detailed Description

Definition at line 14 of file EmptyKeyEncoding.php.

Constructor & Destructor Documentation

Elgg\Json\EmptyKeyEncoding::__construct (   $empty_key = '')

Constructor.

Parameters
string$empty_keyOptional key to replace "" keys with in JSON decode

Definition at line 26 of file EmptyKeyEncoding.php.

Member Function Documentation

Elgg\Json\EmptyKeyEncoding::decode (   $json,
  $assoc = false,
  $depth = 512,
  $options = 0 
)

Decode JSON while converting empty keys to a unique token.

Parameters
string$jsonJSON string
bool$assocConvert objects to assoc arrays?
int$depthAllowed recursion depth
int$optionsBitmask json_decode options
Returns
mixed
See also
json_decode

Definition at line 53 of file EmptyKeyEncoding.php.

Elgg\Json\EmptyKeyEncoding::encode (   $value,
  $options = 0,
  $depth = 512 
)

Encode JSON while converting unique token keys to empty strings.

Parameters
mixed$valueValue to encode
int$optionsEncoding options
int$depthAllowed recursion depth. Do not set this before PHP 5.5
Returns
string|false

Definition at line 69 of file EmptyKeyEncoding.php.

Elgg\Json\EmptyKeyEncoding::getEmptyKey ( )

Get the key that represents an empty string key in JSON.

Returns
string

Definition at line 38 of file EmptyKeyEncoding.php.

Member Data Documentation

Elgg\Json\EmptyKeyEncoding::$token
protected

Definition at line 19 of file EmptyKeyEncoding.php.


The documentation for this class was generated from the following file: