Exemple #1
0
 function doOutput(array $args, stdClass $context, $result)
 {
     $mode = $context->mode;
     $simple = $context->simple;
     if ($simple === null) {
         $simple = $this->simple;
     }
     if ($mode === ResultMode::RawWithEndTag || $mode == ResultMode::Raw) {
         return $result;
     }
     $stream = new BytesIO();
     $writer = new Writer($stream, $simple);
     $stream->write(Tags::TagResult);
     if ($mode === ResultMode::Serialized) {
         $stream->write($result);
     } else {
         $writer->reset();
         $writer->serialize($result);
     }
     if ($context->byref) {
         $stream->write(Tags::TagArgument);
         $writer->reset();
         $writer->writeArray($args);
     }
     $data = $stream->toString();
     $stream->close();
     return $data;
 }
Exemple #2
0
 private function encode($name, array $args, stdClass $context)
 {
     $stream = new BytesIO(Tags::TagCall);
     $writer = new Writer($stream, $context->simple);
     $writer->writeString($name);
     if (count($args) > 0 || $context->byref) {
         $writer->reset();
         $writer->writeArray($args);
         if ($context->byref) {
             $writer->writeBoolean(true);
         }
     }
     $stream->write(Tags::TagEnd);
     $request = $stream->toString();
     $stream->close();
     return $request;
 }