PHP 클래스 Gpf_Rpc_Json

상속: implements Gpf_Rpc_DataEncoder, implements Gpf_Rpc_DataDecoder
파일 보기 프로젝트 열기: fubralimited/php-oara 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( integer $use ) constructs a new JSON instance
decode ( string $str ) : mixed decodes a JSON string into appropriate variable
decodeStatic ( $var )
encode ( mixed $var, $options = null ) : mixed encodes an arbitrary variable into JSON format
encodeResponse ( Gpf_Rpc_Serializable $response )
encodeStatic ( $var, $options = null )
isError ( $data, $code = null )
name_value ( string $name, mixed $value, $options = null ) : string array-walking function for use in generating JSON-formatted name-value pairs
reduce_string ( $str ) : string reduce a string by removing leading and trailing comments and whitespace
utf162utf8 ( string $utf16 ) : string convert a string from one UTF-16 char to one UTF-8 char
utf82utf16 ( string $utf8 ) : string convert a string from one UTF-8 char to one UTF-16 char

보호된 메소드들

메소드 설명
isJsonDecodeEnabled ( )
isJsonEncodeEnabled ( )

비공개 메소드들

메소드 설명
getInstance ( )

메소드 상세

__construct() 공개 메소드

constructs a new JSON instance
public __construct ( integer $use )
$use integer object behavior flags; combine with boolean-OR possible values: - SERVICES_JSON_LOOSE_TYPE: loose typing. "{...}" syntax creates associative arrays instead of objects in decode(). - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. Values which can't be encoded (e.g. resources) appear as NULL instead of throwing errors. By default, a deeply-nested resource will bubble up with an error, so all return values from encode() should be checked with isError()

decode() 공개 메소드

decodes a JSON string into appropriate variable
public decode ( string $str ) : mixed
$str string JSON-formatted string
리턴 mixed number, boolean, string, array, or object corresponding to given JSON input string. See argument 1 to Services_JSON() above for object-output behavior. Note that decode() always returns strings in ASCII or UTF-8 format!

decodeStatic() 공개 정적인 메소드

public static decodeStatic ( $var )

encode() 공개 메소드

encodes an arbitrary variable into JSON format
public encode ( mixed $var, $options = null ) : mixed
$var mixed any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a strng, note that encode() always expects it to be in ASCII or UTF-8 format!
리턴 mixed JSON string representation of input var or an error if a problem occurs

encodeResponse() 공개 메소드

public encodeResponse ( Gpf_Rpc_Serializable $response )
$response Gpf_Rpc_Serializable

encodeStatic() 공개 정적인 메소드

public static encodeStatic ( $var, $options = null )

isError() 공개 메소드

public isError ( $data, $code = null )

isJsonDecodeEnabled() 보호된 메소드

protected isJsonDecodeEnabled ( )

isJsonEncodeEnabled() 보호된 메소드

protected isJsonEncodeEnabled ( )

name_value() 공개 메소드

array-walking function for use in generating JSON-formatted name-value pairs
public name_value ( string $name, mixed $value, $options = null ) : string
$name string name of key to use
$value mixed reference to an array element to be encoded
리턴 string JSON-formatted name-value pair, like '"name":value'

reduce_string() 공개 메소드

reduce a string by removing leading and trailing comments and whitespace
public reduce_string ( $str ) : string
$str string string value to strip of comments and whitespace
리턴 string string value stripped of comments and whitespace

utf162utf8() 공개 메소드

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.
public utf162utf8 ( string $utf16 ) : string
$utf16 string UTF-16 character
리턴 string UTF-8 character

utf82utf16() 공개 메소드

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.
public utf82utf16 ( string $utf8 ) : string
$utf8 string UTF-8 character
리턴 string UTF-16 character