Static Public Member Functions |
static | encode ($value, $cycleCheck=false) |
| Use the JSON encoding scheme for the value specified.
|
static | encodeClass ($className, $package= '') |
| Encodes the given $className into the class2 model of encoding PHP classes into JavaScript class2 classes.
|
static | encodeClasses (array $classNames, $package= '') |
| Encode several classes at once.
|
Protected Member Functions |
| __construct ($cycleCheck=false) |
| Constructor.
|
| _encodeValue (&$value) |
| Recursive driver which determines the type of value to be encoded and then dispatches to the appropriate method.
|
| _encodeObject (&$value) |
| Encode an object to JSON by encoding each of the public properties.
|
| _wasVisited (&$value) |
| Determine if an object has been serialized already.
|
| _encodeArray (&$array) |
| JSON encode an array value.
|
| _encodeDatum (&$value) |
| JSON encode a basic data type (string, number, boolean, null)
|
| _encodeString (&$string) |
| JSON encode a string value by escaping characters as necessary.
|
Protected Attributes |
| $_cycleCheck |
| $_visited = array() |
Constructor & Destructor Documentation
Zend_Json_Encoder::__construct |
( |
|
$cycleCheck = false | ) |
|
|
protected |
Constructor.
- Parameters
-
boolean | $cycleCheck | Whether or not to check for recursion when encoding |
- Returns
- void
Member Function Documentation
Zend_Json_Encoder::_encodeArray |
( |
& |
$array | ) |
|
|
protected |
JSON encode an array value.
Recursively encodes each value of an array and returns a JSON encoded array string.
Arrays are defined as integer-indexed arrays starting at index 0, where the last index is (count($array) -1); any deviation from that is considered an associative array, and will be encoded as such.
- Parameters
-
- Returns
- string
Zend_Json_Encoder::_encodeDatum |
( |
& |
$value | ) |
|
|
protected |
JSON encode a basic data type (string, number, boolean, null)
If value type is not a string, number, boolean, or null, the string 'null' is returned.
- Parameters
-
- Returns
- string
Zend_Json_Encoder::_encodeObject |
( |
& |
$value | ) |
|
|
protected |
Encode an object to JSON by encoding each of the public properties.
A special property is added to the JSON object called '__className' that contains the name of the class of $value. This is used to decode the object on the client into a specific class.
- Parameters
-
- Returns
- string
- Exceptions
-
Zend_Json_Exception | If recursive checks are enabled and the object has been serialized previously |
Zend_Json_Encoder::_encodeString |
( |
& |
$string | ) |
|
|
protected |
JSON encode a string value by escaping characters as necessary.
- Parameters
-
- Returns
- string
Zend_Json_Encoder::_encodeValue |
( |
& |
$value | ) |
|
|
protected |
Recursive driver which determines the type of value to be encoded and then dispatches to the appropriate method.
$values are either
- Parameters
-
$value | mixed The value to be encoded |
- Returns
- string Encoded value
Zend_Json_Encoder::_wasVisited |
( |
& |
$value | ) |
|
|
protected |
Determine if an object has been serialized already.
- Parameters
-
- Returns
- boolean
static Zend_Json_Encoder::encode |
( |
|
$value, |
|
|
|
$cycleCheck = false |
|
) |
| |
|
static |
Use the JSON encoding scheme for the value specified.
- Parameters
-
mixed | $value | The value to be encoded |
boolean | $cycleCheck | Whether or not to check for possible object recursion when encoding |
- Returns
- string The encoded value
static Zend_Json_Encoder::encodeClass |
( |
|
$className, |
|
|
|
$package = '' |
|
) |
| |
|
static |
Encodes the given $className into the class2 model of encoding PHP classes into JavaScript class2 classes.
NOTE: Currently only public methods and variables are proxied onto the client machine
- Parameters
-
$className | string The name of the class, the class must be instantiable using a null constructor |
$package | string Optional package name appended to JavaScript proxy class name |
- Returns
- string The class2 (JavaScript) encoding of the class
- Exceptions
-
static Zend_Json_Encoder::encodeClasses |
( |
array |
$classNames, |
|
|
|
$package = '' |
|
) |
| |
|
static |
Encode several classes at once.
Returns JSON encoded classes, using encodeClass().
- Parameters
-
array | $classNames | |
string | $package | |
- Returns
- string
The documentation for this class was generated from the following file: