Json/Decoder.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Json  
Version
$Id$  

\Zend_Json_Decoder

Package: Zend_Json
Decode JSON encoded string to PHP variable constructs
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  EOF = 0
Parse tokens used to decode the JSON object. These are not for public consumption, they are just used internally to the class.
>VConstant  DATUM = 1
>VConstant  LBRACE = 2
>VConstant  LBRACKET = 3
>VConstant  RBRACE = 4
>VConstant  RBRACKET = 5
>VConstant  COMMA = 6
>VConstant  COLON = 7

Properties

>VPropertyprotectedint $_decodeType
Flag indicating how objects should be decoded
Details
Type
int
Access
protected  
>VPropertyprotectedint $_offset
The offset within the souce being decoded
Details
Type
int
>VPropertyprotectedstring $_source
Use to maintain a "pointer" to the source being decoded
Details
Type
string
>VPropertyprotectedint $_sourceLength
Caches the source length
Details
Type
int
>VPropertyprotectedint $_token
The current token being considered in the parser cycle
Details
Type
int

Methods

methodprotected__construct(string $source, int $decodeType) : void

Constructor

Parameters
NameTypeDescription
$sourcestring

String source to decode

$decodeTypeint

How objects should be decoded -- see {@link Zend_Json::TYPE_ARRAY} and {@link Zend_Json::TYPE_OBJECT} for valid values

methodprotected_decodeArray() : array

Decodes a JSON array format: [element, element2,.

..,elementN]
Returns
TypeDescription
array
methodprotected_decodeObject() : array | \StdClass

Decodes an object of the form: { "attribute: value, "attribute2" : value,.

..} If Zend_Json_Encoder was used to encode the original object then a special attribute called __className which specifies a class name that should wrap the data contained within the encoded source. Decodes to either an array or StdClass object, based on the value of {@link $_decodeType}. If invalid $_decodeType present, returns as an array.
Returns
TypeDescription
array | \StdClass
methodprotected_decodeValue() : mixed

Recursive driving rountine for supported toplevel tops

Returns
TypeDescription
mixed
methodprotected_eatWhitespace() : void

Removes whitepsace characters from the source input

methodprotected_getNextToken() : int

Retrieves the next token from the source stream

Returns
TypeDescription
intToken constant value specified in class definition
methodprotected_utf162utf8(string $utf16) : string
static

Convert a string from one UTF-16 char to one UTF-8 char.

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension. This method is from the Solar Framework by Paul M. Jones
Parameters
NameTypeDescription
$utf16string

UTF-16 character

Returns
TypeDescription
stringUTF-8 character
Details
Link
http://solarphp.com  
methodpublicdecode(string $source = null, int $objectDecodeType = \Zend_Json::TYPE_ARRAY) : mixed
static

Decode a JSON source string

Decodes a JSON encoded string. The value returned will be one of the following: - integer - float - boolean - null - StdClass - array - array of one or more of the above types By default, decoded objects will be returned as associative arrays; to return a StdClass object instead, pass {@link Zend_Json::TYPE_OBJECT} to the $objectDecodeType parameter. Throws a Zend_Json_Exception if the source string is null.
Parameters
NameTypeDescription
$sourcestring

String to be decoded

$objectDecodeTypeint

How objects should be decoded; should be either or {@link Zend_Json::TYPE_ARRAY} or {@link Zend_Json::TYPE_OBJECT}; defaults to TYPE_ARRAY

Returns
TypeDescription
mixed
Throws
ExceptionDescription
\Zend_Json_Exception
Details
Access
public  
Static
 
methodpublicdecodeUnicodeString( $chrs) : string
static

Decode Unicode Characters from \u0000 ASCII syntax.

This algorithm was originally developed for the Solar Framework by Paul M. Jones
Parameters
NameTypeDescription
$chrs
Returns
TypeDescription
string
Details
Link
http://solarphp.com/  
Link
http://svn.solarphp.com/core/trunk/Solar/Json.php  
Documentation was generated by phpDocumentor 2.2.0 .