Overview Package Tree | HessianPHP |
FRAMES NO FRAMES | |
SUMMARY: FIELD METHOD | DETAIL: FIELD METHOD |
HessianPHP.Protocol.HessianProtocolHandler
|
+--HessianPHP.Protocol.HessianWriter
class HessianWriter
extends HessianProtocolHandler
Hessian protocol writer, inspired and partially based on hessianlib.py by Caucho.
TODO:
- Handling of _hessian_write function
Field Summary |
---|
public var | $fault |
Fields inherited from HessianPHP.Protocol.HessianProtocolHandler | |
---|---|
$stream $pos $len $refs $error $dateProvider $typemap |
Method Summary |
---|
public void | setFault Sets the reply as a fault, following Hessian spec |
public void | writeObject Serializes a PHP value into a Hessian stream using reflection. |
public string | writeReply Writes a Hessian reply with a return object. |
public string | writeCall Writes a Hessian method call and serializes arguments. |
public void | writeBool |
public void | writeString |
public void | writeHeader |
public void | writeBytes |
public void | writeFault |
public void | writeInt |
public void | writeLong |
public void | writeDate |
public void | writeDouble |
public void | writeStringData |
public boolean | writeReference Checks internal reference map to see if an object has already been written to output stream. |
public void | writeList |
public void | writeMap |
public boolean | isArrayAssoc Very simple way to check if an array is associative. |
public boolean | isList EXPERIMENTAL: Algorithm to check if a php associative array is *exactly* an ordered list. |
public void | writeResource |
Methods inherited from HessianPHP.Protocol.HessianProtocolHandler | |
---|---|
HessianProtocolHandler, clearRefs, setStream, setDateProvider, setTypeMap |
Field Detail |
---|
public var $fault = false
Method Detail |
---|
public void setFault(string code, string message, mixed detail = null)
Sets the reply as a fault, following Hessian spec
code
- Code number of the fault message
- Descriptive message of the fault detail
- Optional argument with detail of the fault, usually a stack trace public void writeObject(mixed value)
Serializes a PHP value into a Hessian stream using reflection.
Depending on the type it calls one of the writing functions of this class.
value
- Value to be serialized public string writeReply(mixed object)
Writes a Hessian reply with a return object.
If a fault has been set, it writes the fault instead
object
- Object to be returned in the reply public string writeCall(string method, array params)
Writes a Hessian method call and serializes arguments.
method
- Method to be called params
- Arguments of the method public void writeBool(var $value)
$value
public void writeString(var $value)
$value
public void writeHeader(var $value)
$value
public void writeBytes(var $value)
$value
public void writeFault(var $code, var $message, var $detail)
$code
$message
$detail
public void writeInt(var $value)
$value
public void writeLong(var $value)
$value
public void writeDate(var $value)
$value
public void writeDouble(var $value)
$value
public void writeStringData(var $value)
$value
public boolean writeReference(mixed value)
Checks internal reference map to see if an object has already been written to output stream.
If it has, it only writes a reference to it and returns true, otherwise returns false WARNING: in PHP4, don't use circular references or this function will crash!
value
- object public void writeList(var $value)
$value
public void writeMap(var $value)
$value
public boolean isArrayAssoc(array array)
Very simple way to check if an array is associative.
PHP doesn't have a way to tell an associative array from one that only has numbers as keys. Never mind the foreach, it's *faster* than other ways. Stops when a key is of string type or the key is negative, yes, you are read it well, array keys can be negative (and also null, and false, and...)
array
- Array to check public boolean isList(array array)
EXPERIMENTAL: Algorithm to check if a php associative array is *exactly* an ordered list.
It uses a property of ordered lists numeric keys, they correspond to the 0,1,2...n series of continuous integers, therefore you can check if an array is an ordered list by calculating the sum of its keys by hand and then using a formula. If both values match, it is an ordered list. Just Slightly slower than isArrayAssoc but safer. (currently not being used)
array
- Array to check public void writeResource(var $handle)
$handle
Overview Package Tree | HessianPHP |
FRAMES NO FRAMES | |
SUMMARY: FIELD METHOD | DETAIL: FIELD METHOD |