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; }