PHP Class Amfphp_Core_Amf_Deserializer, amfphp-2.0

ファイルを表示 Open project: silexlabs/amfphp-2.0 Class Usage Examples

Public Properties

Property Type Description
$voConverter Amfphp_Core_Common_IVoConverter converts VOs directly if set, rather than instanciating anonymous classes that are converted later

Protected Properties

Property Type Description
$amf0storedObjects array objects stored for tracking references(amf0)
$currentByte integer The current seek cursor of the stream note: must be initialised here to avoid error 'String offset cast occured'
$deserializedPacket the Packet contained in the serialized data
$headersLeftToProcess integer The number of headers in the packet left to process
$messagesLeftToProcess integer The number of Messages in the packet left to process
$rawData string data to deserialize
$storedDefinitions array class definitions(traits) stored for tracking references(amf3)
$storedObjects array objects stored for tracking references(amf3)
$storedStrings array strings stored for tracking references(amf3)

Public Methods

Method Description
deserialize ( array $getData, array $postData, string $rawPostData ) : Amfphp_Core_Amf_Packet convert from text/binary to php object
readAmf3Data ( ) : mixed read the type byte, then call the corresponding amf3 data reading function
readData ( mixed $type ) : mixed readData is the main switch for mapping a type code to an actual implementation for deciphering it.

Protected Methods

Method Description
readAmf3Array ( ) : array read amf 3 array
readAmf3ByteArray ( ) : Amfphp_Core_Amf_Types_ByteArray read Amf 3 byte array
readAmf3Date ( ) : boolean | Amfphp_Core_Amf_Types_Date read amf 3 date
readAmf3Int ( ) : read Handle decoding of the variable-length representation which gives seven bits of value per serialized byte by using the high-order bit of each byte as a continuation flag.
readAmf3Object ( ) : mixed read amf 3 object
readAmf3String ( ) : string readString
readAmf3Vector ( $type ) : array Reads a vector array of objects from the AMF stream. This works for all vector arrays: vector-object, vector-int vector-uint and vector-double. The Vector is cast to a PHP array. Please note that because of the way php handles integers, uints have to be cast as floats. See {@link http://php.net/manual/en/language.types.integer.php}
readAmf3VectorValue ( $length, $format ) : Read numeric values from the AMF byte stream. Please be aware that unsigned integers are not really supported in PHP, and for this reason unsigned integers are cast to float. {@link http://php.net/manual/en/language.types.integer.php}.
readAmf3Xml ( ) : Amfphp_Core_Amf_Types_Xml read amf 3 xml
readAmf3XmlDocument ( ) : Amfphp_Core_Amf_Types_Xml read amf 3 xml doc
readArray ( ) : array readArray turns an all numeric keyed actionscript array into a php array.
readBuffer ( type $len ) : mixed read some data and move pointer
readByte ( ) : integer readByte grabs the next byte from the data stream and returns it.
readCustomClass ( ) : object readCustomClass reads the amf content associated with a class instance which was registered with Object.registerClass.
readDate ( ) : Amfphp_Core_Amf_Types_Date readDate reads a date from the amf Packet and returns the time in ms.
readDouble ( ) : float readDouble reads the floating point value from the bytes stream and properly orders the bytes depending on the system architecture.
readHeaders ( ) readHeaders converts that header section of the amf Packet into php obects.
readInt ( ) : integer readInt grabs the next 2 bytes and returns the next two bytes, shifted and combined to produce the resulting integer
readLong ( ) : integer readLong grabs the next 4 bytes shifts and combines them to produce an integer
readLongUTF ( ) : string readLongUTF first grabs the next 4 bytes which represent the string length.
readMessages ( ) read messages in AMF packet
readMixedArray ( ) : array readMixedArray turns an array with numeric and string indexes into a php array
readMixedObject ( ) : array readMixedObject reads the name/value properties of the amf Packet and converts numeric looking keys to numeric keys
readObject ( ) : Object readObject reads the name/value properties of the amf Packet and converts them into their equivilent php representation
readReference ( ) : String readReference replaces the old readFlushedSO. It treats where there are references to other objects. Currently it does not resolve the object as this would involve a serious amount of overhead, unless you have a genius idea
readUTF ( ) : string readUTF first grabs the next 2 bytes which represent the string length.
readXml ( ) : Amfphp_Core_Amf_Types_Xml read xml
resetReferences ( ) reset reference stores
resolveType ( type $typeIdentifier ) : stdClass tries to use the type to get a typed object. If not possible, return a stdClass, with the explicit type marker set if the type was not just an empty string

Method Details

deserialize() public method

convert from text/binary to php object
public deserialize ( array $getData, array $postData, string $rawPostData ) : Amfphp_Core_Amf_Packet
$getData array
$postData array
$rawPostData string
return Amfphp_Core_Amf_Packet

readAmf3Array() protected method

read amf 3 array
protected readAmf3Array ( ) : array
return array

readAmf3ByteArray() protected method

read Amf 3 byte array
protected readAmf3ByteArray ( ) : Amfphp_Core_Amf_Types_ByteArray
return Amfphp_Core_Amf_Types_ByteArray

readAmf3Data() public method

read the type byte, then call the corresponding amf3 data reading function
public readAmf3Data ( ) : mixed
return mixed

readAmf3Date() protected method

read amf 3 date
protected readAmf3Date ( ) : boolean | Amfphp_Core_Amf_Types_Date
return boolean | Amfphp_Core_Amf_Types_Date

readAmf3Int() protected method

Handle decoding of the variable-length representation which gives seven bits of value per serialized byte by using the high-order bit of each byte as a continuation flag.
protected readAmf3Int ( ) : read
return read integer value

readAmf3Object() protected method

read amf 3 object
protected readAmf3Object ( ) : mixed
return mixed stdClass, or VoClass if VoConverter could find it.

readAmf3String() protected method

readString
protected readAmf3String ( ) : string
return string

readAmf3Vector() protected method

Reads a vector array of objects from the AMF stream. This works for all vector arrays: vector-object, vector-int vector-uint and vector-double. The Vector is cast to a PHP array. Please note that because of the way php handles integers, uints have to be cast as floats. See {@link http://php.net/manual/en/language.types.integer.php}
protected readAmf3Vector ( $type ) : array
return array The objects in the vector in a native PHP array.

readAmf3VectorValue() protected method

Read numeric values from the AMF byte stream. Please be aware that unsigned integers are not really supported in PHP, and for this reason unsigned integers are cast to float. {@link http://php.net/manual/en/language.types.integer.php}.
protected readAmf3VectorValue ( $length, $format ) :
return

readAmf3Xml() protected method

read amf 3 xml
protected readAmf3Xml ( ) : Amfphp_Core_Amf_Types_Xml
return Amfphp_Core_Amf_Types_Xml

readAmf3XmlDocument() protected method

read amf 3 xml doc
protected readAmf3XmlDocument ( ) : Amfphp_Core_Amf_Types_Xml
return Amfphp_Core_Amf_Types_Xml

readArray() protected method

readArray turns an all numeric keyed actionscript array into a php array.
protected readArray ( ) : array
return array The php array

readBuffer() protected method

read some data and move pointer
protected readBuffer ( type $len ) : mixed
$len type
return mixed

readByte() protected method

readByte grabs the next byte from the data stream and returns it.
protected readByte ( ) : integer
return integer The next byte converted into an integer

readCustomClass() protected method

If a VoConverter is available, it is used to instanciate the Vo. If not, In order to preserve the class name an additional property is assigned to the object Amfphp_Core_Amf_Constants::FIELD_EXPLICIT_TYPE. This property will be overwritten if it existed within the class already.
protected readCustomClass ( ) : object
return object The php representation of the object

readData() public method

readData is the main switch for mapping a type code to an actual implementation for deciphering it.
public readData ( mixed $type ) : mixed
$type mixed The $type integer
return mixed The php version of the data in the Packet block

readDate() protected method

This method is still under development.
protected readDate ( ) : Amfphp_Core_Amf_Types_Date
return Amfphp_Core_Amf_Types_Date a container with the date in ms.

readDouble() protected method

readDouble reads the floating point value from the bytes stream and properly orders the bytes depending on the system architecture.
protected readDouble ( ) : float
return float The floating point value of the next 8 bytes

readHeaders() protected method

Header information typically contains meta data about the Packet.
protected readHeaders ( )

readInt() protected method

readInt grabs the next 2 bytes and returns the next two bytes, shifted and combined to produce the resulting integer
protected readInt ( ) : integer
return integer The resulting integer from the next 2 bytes

readLong() protected method

readLong grabs the next 4 bytes shifts and combines them to produce an integer
protected readLong ( ) : integer
return integer The resulting integer from the next 4 bytes

readLongUTF() protected method

Then it grabs the next (len) bytes of the resulting in the string
protected readLongUTF ( ) : string
return string The utf8 decoded string

readMessages() protected method

read messages in AMF packet
protected readMessages ( )

readMixedArray() protected method

readMixedArray turns an array with numeric and string indexes into a php array
protected readMixedArray ( ) : array
return array The php array with mixed indexes

readMixedObject() protected method

readMixedObject reads the name/value properties of the amf Packet and converts numeric looking keys to numeric keys
protected readMixedObject ( ) : array
return array The php array with the object data

readObject() protected method

readObject reads the name/value properties of the amf Packet and converts them into their equivilent php representation
protected readObject ( ) : Object
return Object The php object filled with the data

readReference() protected method

readReference replaces the old readFlushedSO. It treats where there are references to other objects. Currently it does not resolve the object as this would involve a serious amount of overhead, unless you have a genius idea
protected readReference ( ) : String
return String

readUTF() protected method

Then it grabs the next (len) bytes of the resulting string.
protected readUTF ( ) : string
return string The utf8 decoded string

readXml() protected method

read xml
protected readXml ( ) : Amfphp_Core_Amf_Types_Xml
return Amfphp_Core_Amf_Types_Xml

resetReferences() protected method

reset reference stores
protected resetReferences ( )

resolveType() protected method

tries to use the type to get a typed object. If not possible, return a stdClass, with the explicit type marker set if the type was not just an empty string
protected resolveType ( type $typeIdentifier ) : stdClass
$typeIdentifier type
return stdClass or typed object

Property Details

$amf0storedObjects protected_oe property

objects stored for tracking references(amf0)
protected array $amf0storedObjects
return array

$currentByte protected_oe property

The current seek cursor of the stream note: must be initialised here to avoid error 'String offset cast occured'
protected int $currentByte
return integer

$deserializedPacket protected_oe property

the Packet contained in the serialized data
protected $deserializedPacket
return

$headersLeftToProcess protected_oe property

The number of headers in the packet left to process
protected int $headersLeftToProcess
return integer

$messagesLeftToProcess protected_oe property

The number of Messages in the packet left to process
protected int $messagesLeftToProcess
return integer

$rawData protected_oe property

data to deserialize
protected string $rawData
return string

$storedDefinitions protected_oe property

class definitions(traits) stored for tracking references(amf3)
protected array $storedDefinitions
return array

$storedObjects protected_oe property

objects stored for tracking references(amf3)
protected array $storedObjects
return array

$storedStrings protected_oe property

strings stored for tracking references(amf3)
protected array $storedStrings
return array

$voConverter public_oe property

converts VOs directly if set, rather than instanciating anonymous classes that are converted later
public Amfphp_Core_Common_IVoConverter $voConverter
return Amfphp_Core_Common_IVoConverter