Zend\Json\Encoder
Encode PHP constructs to JSON
Synopsis
class Encoder
{
- // members
- protected bool $cycleCheck;
- protected array $options;
- protected array $visited;
- // methods
- protected Encoder __construct()
- public static string encode()
- protected string _encodeValue()
- protected string _encodeObject()
- protected bool _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()
- public static string encodeUnicodeString()
- protected static string _utf82utf16()
Members
protected
- $cycleCheck
—
Zend\Json\bool
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()})
- _utf82utf16() — Convert a string from one UTF-8 char to one UTF-16 char.
- _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
- encodeUnicodeString() — Encode Unicode Characters to \u0000 ASCII syntax.