Encoder
in package
uses
SerializerAware
A helper class to easily convert between Value objects and php native values
Tags
Table of Contents
Properties
- $serializer : mixed
Methods
- decode() : mixed
- Takes a json-rpc value in object format and translates it into native PHP types.
- encode() : Value
- Takes native php types and encodes them into json-rpc PHP object format.
- getSerializer() : mixed
- setSerializer() : mixed
Properties
$serializer
protected
static mixed
$serializer
Methods
decode()
Takes a json-rpc value in object format and translates it into native PHP types.
public
decode(Value|Request $jsonrpcVal[, array<string|int, mixed> $options = array() ]) : mixed
Works with xml-rpc value objects as input, too.
Parameters
- $jsonrpcVal : Value|Request
- $options : array<string|int, mixed> = array()
-
if 'decode_php_objs' is set in the options array, json-rpc objects can be decoded into php objects
Tags
encode()
Takes native php types and encodes them into json-rpc PHP object format.
public
encode(mixed $phpVal[, array<string|int, mixed> $options = array() ]) : Value
It will not re-encode Value objects. Empty php arrays get encoded as json arrays, never as hashes.
Parameters
- $phpVal : mixed
-
the value to be converted into a Value object
- $options : array<string|int, mixed> = array()
-
can include 'encode_php_objs', 'auto_dates' (which means php DateTimes will be encoded as iso datetime strings)
Return values
ValuegetSerializer()
public
getSerializer() : mixed
setSerializer()
public
static setSerializer(mixed $serializer) : mixed
Parameters
- $serializer : mixed