encode()
encodeClass()
encodeClasses()
encodeUnicodeString()
__construct()
_encodeArray()
_encodeDatum()
_encodeObject()
_encodeString()
_encodeValue()
_utf82utf16()
_wasVisited()
_encodeConstants()
_encodeMethods()
_encodeVariables()
$cycleCheck
$options
$visited
Encode PHP constructs to JSON
encode(mixed $value, bool $cycleCheck, array $options) : string
mixed
The value to be encoded
bool
Whether or not to check for possible object recursion when encoding
array
Additional options used during encoding
string
The encoded valueencodeClass(\Zend\Json\$className $className, \Zend\Json\$package $package) : string
NOTE: Currently only public methods and variables are proxied onto the client machine
\Zend\Json\$className
string The name of the class, the class must be instantiable using a null constructor
\Zend\Json\$package
string Optional package name appended to JavaScript proxy class name
\Zend\Json\Exception\InvalidArgumentException |
---|
string
The class2 (JavaScript) encoding of the classencodeClasses(array $classNames, string $package) : string
Returns JSON encoded classes, using encodeClass().
array
string
string
encodeUnicodeString(string $value) : string
This algorithm was originally developed for the Solar Framework by Paul M. Jones
link | http://solarphp.com/ |
---|---|
link | https://github.com/solarphp/core/blob/master/Solar/Json.php |
string
string
__construct(bool $cycleCheck, array $options) : \Zend\Json\Encoder
bool
Whether or not to check for recursion when encoding
array
Additional options used during encoding
_encodeArray(\Zend\Json\$array $array) : string
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.
\Zend\Json\$array
array
string
_encodeDatum(mixed $value) : string
If value type is not a string, number, boolean, or null, the string 'null' is returned.
mixed
string
_encodeObject(\Zend\Json\$value $value) : string
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.
\Zend\Json\$value
object
\Zend\Json\Exception\RecursionException |
If recursive checks are enabled and the object has been serialized previously |
---|
string
_encodeString(string $string) : string
string
string
_encodeValue(\Zend\Json\$value $value) : string
$values are either - objects (returns from _encodeObject()) - arrays (returns from _encodeArray()) - basic datums (e.g. numbers or strings) (returns from _encodeDatum())
\Zend\Json\$value
mixed The value to be encoded
string
Encoded value_utf82utf16(string $utf8) : string
Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibyte string extension.
This method is from the Solar Framework by Paul M. Jones
link | http://solarphp.com |
---|
string
UTF-8 character
string
UTF-16 character_wasVisited(mixed $value) : bool
mixed
bool
_encodeConstants(\ReflectionClass $cls) : string
The encoding format is based on the class2 format
\ReflectionClass
string
Encoded constant block in class2 format_encodeMethods(\ReflectionClass $cls) : string
_encodeVariables(\ReflectionClass $cls) : string
$cycleCheck : bool
$visited : array