public function readData($type)
{
switch ($type) {
//amf3 is now most common, so start with that
case 0x11:
//Amf3-specific
return $this->readAmf3Data();
break;
case 0:
// number
return $this->readDouble();
case 1:
// boolean
return $this->readByte() == 1;
case 2:
// string
return $this->readUTF();
case 3:
// object Object
return $this->readObject();
//ignore movie clip
//ignore movie clip
case 5:
// null
return null;
case 6:
// undefined
return new Amfphp_Core_Amf_Types_Undefined();
case 7:
// Circular references are returned here
return $this->readReference();
case 8:
// mixed array with numeric and string keys
return $this->readMixedArray();
case 9:
//object end. not worth , TODO maybe some integrity checking
return null;
case 0xa:
// array
return $this->readArray();
case 0xb:
// date
return $this->readDate();
case 0xc:
// string, strlen(string) > 2^16
return $this->readLongUTF();
case 0xd:
// mainly internal AS objects
return null;
//ignore recordset
//ignore recordset
case 0xf:
// XML
return $this->readXml();
case 0x10:
// Custom Class
return $this->readCustomClass();
default:
// unknown case
throw new Amfphp_Core_Exception("Found unhandled type with code: {$type}");
exit;
break;
}
return $data;
}