private function getClassInfo($refId, FlashorbBinaryReader $reader, ParseContext $parseContext) { if (($refId & 0x3) == 1) { return $parseContext->getClassInfoReference($refId >> 2); } $looseProps = ($refId & 0x8) == 8; $className = ReaderUtils::readString($reader, $parseContext); $classInfo = new ClassInfo($looseProps, $className); $propsCount = $refId >> 4; if (LOGGING) { Log::log(LoggingConstants::SERIALIZATION, "Readed class info, class: {$className}, property count:{$propsCount}"); } for ($i = 0; $i < $propsCount; $i++) { $classInfo->addProperty(ReaderUtils::readString($reader, $parseContext)); } $parseContext->addClassInfoReference($classInfo); return $classInfo; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $refId = $reader->readVarInteger(); if (($refId & 0x1) == 0) { return $parseContext->getReference($refId >> 1); } $arraySize = $refId >> 1; $adaptingType = null; $container = null; while (true) { $str = ReaderUtils::readString($reader, $parseContext); if (is_null($str) || strlen($str) == 0) { break; } if (is_null($container)) { $container = array(); $adaptingType = new AnonymousObject($container); $parseContext->addReference($adaptingType); } $container[$str] = AmfMessageFactory::readData($reader, $parseContext, null); } if (is_null($adaptingType)) { $container = array(); $adaptingType = new ArrayType($container); $parseContext->addReference($adaptingType); for ($i = 0; $i < $arraySize; $i++) { $container[$i] = AmfMessageFactory::readData($reader, $parseContext, null); } } else { for ($i = 0; $i < $arraySize; $i++) { $obj = AmfMessageFactory::readData($reader, $parseContext, null); $container[(string) $i] = $obj; } } return $adaptingType; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { return new StringType(ReaderUtils::readString($reader, $parseContext)); }