MAX_STORED_OBJECTS
MAX_STORED_OBJECTS
the maximum amount of objects stored for reference
AmfSerializer manages the job of translating PHP objects into the actionscript equivalent via Amf. The main method of the serializer is the serialize method which takes and AmfObject as it's argument and builds the resulting Amf Message.
$voConverter : \Amfphp_Core_Common_IVoConverter
converts VOs directly if set, rather than instanciating anonymous classes that are converted later
$packet : \Amfphp_Core_Amf_Packet
packet
serialize(\Amfphp_Core_Amf_Packet $data) : String
converts from php object to binary
\Amfphp_Core_Amf_Packet | $data |
writeXML(\Amfphp_Core_Amf_Types_Xml $d)
writeXML writes the xml code (0x0F) and the XML string to the output stream Note: strips whitespace
\Amfphp_Core_Amf_Types_Xml | $d |
writeDate(\Amfphp_Core_Amf_Types_Date $d)
writeDate writes the date code (0x0B) and the date value (milliseconds from 1 January 1970) to the output stream, along with an empty unsupported timezone
\Amfphp_Core_Amf_Types_Date | $d | The date value |
writeObjectFromArray(array $d)
writeObjectFromArray handles writing a php array with string or mixed keys. It does not write the object code as that is handled by the writeArrayOrObject and this method is shared with the CustomClass writer which doesn't use the object code.
array | $d | The php array with string keys |
writeTypedObject(object $d)
writeTypedObject takes an instance of a class and writes the variables defined in it to the output stream.
To accomplish this we just blanket grab all of the object vars with get_object_vars, minus the Amfphp_Core_Amf_Constants::FIELD_EXPLICIT_TYPE field, whiuch is used as class name
object | $d | The object to serialize the properties. The deserializer looks for Amfphp_Core_Amf_Constants::FIELD_EXPLICIT_TYPE on this object and writes it as the class name. |
writeAmf3String(string $d) : \The
Write a string (Amf3). Strings are stored in a cache and in case the same string is written again, a reference to the string is sent instead of the string itself.
note: Sending strings larger than 268435455 (2^28-1 byte) will (silently) fail!
note: The string marker is NOT sent here and has to be sent before, if needed.
string | $d | the string to send |
reference index inside the lookup table is returned. In case of an empty string which is sent in a special way, NULL is returned.
writeAmf3AnonymousObject(\stdClass $d, $doReference)
handles writing an anoynous object (stdClass) can also be a reference Also creates a bogus traits entry, as even an anonymous object has traits. In this way a reference to a class trait will have the right id.
\stdClass | $d | The php object to write |
$doReference |
getAmf3Int(integer $d) : string
Return the serialisation of the given integer (Amf3).
note: There does not seem to be a way to distinguish between signed and unsigned integers. This method just sends the lowest 29 bit as-is, and the receiver is responsible to interpret the result as signed or unsigned based on some context.
note: The limit imposed by Amf3 is 29 bit. So in case the given integer is longer than 29 bit, only the lowest 29 bits will be serialised. No error will be logged!
integer | $d | the integer to serialise |
writeAmf3Xml(\Amfphp_Core_Amf_Types_Xml $d)
write Amfphp_Core_Amf_Types_Xml in amf3
\Amfphp_Core_Amf_Types_Xml | $d |
writeAmf3XmlDocument(\Amfphp_Core_Amf_Types_XmlDocument $d)
write Amfphp_Core_Amf_Types_XmlDocument in amf3
\Amfphp_Core_Amf_Types_XmlDocument | $d |
writeAmf3Date(\Amfphp_Core_Amf_Types_Date $d)
write Amfphp_Core_Amf_Types_Date in amf 3
\Amfphp_Core_Amf_Types_Date | $d |
writeAmf3ByteArray(\Amfphp_Core_Amf_Types_ByteArray $d)
write Amfphp_Core_Amf_Types_ByteArray in amf3
\Amfphp_Core_Amf_Types_ByteArray | $d |
handleReference(mixed $obj, array $references)
looks if $obj already has a reference. If it does, write it, and return true. If not, add it to the references array.
Depending on whether or not the spl_object_hash function can be used ( available (PHP >= 5.2), and can only be used on an object) things are handled a bit differently:
This also means that 2 completely separate instances of a class but with the same values will be written fully twice if we can't use the hash system
mixed | $obj | |
array | $references |
writeAMF3Vector(\Amfphp_Core_Amf_Types_Vector $d)
write vector
\Amfphp_Core_Amf_Types_Vector | $d |