Ejemplo n.º 1
0
 public function write(&$obj, IProtocolFormatter $writer)
 {
     $writer->beginWriteMessage($obj);
     $writer->writeMessageVersion($obj->getVersion());
     $headers = $obj->getResponseHeaders();
     $bodies = $obj->getResponseBodies();
     if (LOGGING) {
         Log::log(LoggingConstants::DEBUG, "got headers " . count($headers));
         Log::log(LoggingConstants::DEBUG, "got bodies " . count($bodies));
         Log::log(LoggingConstants::DEBUG, "message version: " . $obj->getVersion());
     }
     $headerCount = count($headers);
     $writer->directWriteShort($headerCount);
     for ($index = 0; $index < $headerCount; $index++) {
         MessageWriter::writeObject($headers[$index], $writer);
     }
     $bodyCount = count($bodies);
     $writer->directWriteShort($bodyCount);
     for ($index = 0; $index < $bodyCount; $index++) {
         MessageWriter::writeObject($bodies[$index], $writer);
     }
     $writer->endWriteMessage();
 }