\Zend_Json_Encoder
Encode PHP constructs to JSON
- Copyright: Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- License: http://framework.zend.com/license/new-bsd New BSD License
Synopsis
class Zend_Json_Encoder
{
- // members
- protected $_cycleCheck;
- protected array $_options = ;
- protected array $_visited = ;
- // methods
- protected void __construct()
- public static string encode()
- protected string _encodeValue()
- protected string _encodeObject()
- protected boolean _wasVisited()
- protected string _encodeArray()
- protected string _encodeDatum()
- protected string _encodeString()
- private static string _encodeConstants()
- private static string _encodeMethods()
- private static string _encodeVariables()
- public static string encodeClass()
- public static string encodeClasses()
Members
protected
- $_cycleCheck
—
boolean
Whether or not to check for possible cycling - $_options
—
array
Additional options used during encoding - $_visited
—
array
Array of visited objects; used to prevent cycling.
Methods
private
- _encodeConstants() — Encode the constants associated with the ReflectionClass parameter. The encoding format is based on the class2 format
- _encodeMethods() — Encode the public methods of the ReflectionClass in the class2 format
- _encodeVariables() — Encode the public properties of the ReflectionClass in the class2 format.
protected
- __construct() — Constructor
- _encodeArray() — JSON encode an array value
- _encodeDatum() — JSON encode a basic data type (string, number, boolean, null)
- _encodeObject() — Encode an object to JSON by encoding each of the public properties
- _encodeString() — JSON encode a string value by escaping characters as necessary
- _encodeValue() — Recursive driver which determines the type of value to be encoded and then dispatches to the appropriate method. $values are either - objects (returns from {@link _encodeObject()}) - arrays (returns from {@link _encodeArray()}) - basic datums (e.g. numbers or strings) (returns from {@link _encodeDatum()})
- _wasVisited() — Determine if an object has been serialized already
public
- encode() — Use the JSON encoding scheme for the value specified
- encodeClass() — Encodes the given $className into the class2 model of encoding PHP classes into JavaScript class2 classes.
- encodeClasses() — Encode several classes at once