Zend\Json\Decoder
Decode JSON encoded string to PHP variable constructs
Synopsis
class Decoder
{
- // constants
- const EOF = 0;
- const DATUM = 1;
- const LBRACE = 2;
- const LBRACKET = 3;
- const RBRACE = 4;
- const RBRACKET = 5;
- const COMMA = 6;
- const COLON = 7;
- // members
- protected string $source;
- protected int $sourceLength;
- protected int $offset;
- protected int $token;
- protected int $decodeType;
- protected $_tokenValue $tokenValue;
- // methods
- protected void __construct()
- public static mixed decode()
- protected mixed _decodeValue()
- protected array|stdClass _decodeObject()
- protected array _decodeArray()
- protected void _eatWhitespace()
- protected int _getNextToken()
- public static string decodeUnicodeString()
- protected static string _utf162utf8()
Constants
Name | Value |
---|---|
EOF | 0 |
DATUM | 1 |
LBRACE | 2 |
LBRACKET | 3 |
RBRACE | 4 |
RBRACKET | 5 |
COMMA | 6 |
COLON | 7 |
Members
protected
- $decodeType
—
int
Flag indicating how objects should be decoded - $offset
—
int
The offset within the source being decoded - $source
—
string
Use to maintain a "pointer" to the source being decoded - $sourceLength
—
int
Caches the source length - $token
—
int
The current token being considered in the parser cycle - $tokenValue — Zend\Json\$_tokenValue
Methods
protected
- __construct() — Constructor
- _decodeArray() — Decodes a JSON array format: [element, element2,...,elementN]
- _decodeObject() — Decodes an object of the form: { "attribute: value, "attribute2" : value,...}
- _decodeValue() — Recursive driving routine for supported toplevel tops
- _eatWhitespace() — Removes whitespace characters from the source input
- _getNextToken() — Retrieves the next token from the source stream
- _utf162utf8() — Convert a string from one UTF-16 char to one UTF-8 char.
public
- decode() — Decode a JSON source string
- decodeUnicodeString() — Decode Unicode Characters from \u0000 ASCII syntax.