public static function toProtobuf($object, $filter = NULL)
	{
		$output = '';

		if (isset($object->name) && ($filter === null || isset($filter['name']))) {
			$output .= "\x0a";
			$output .= Binary::encodeVarint(strlen($object->name));
			$output .= $object->name;
		}

		if (isset($object->inputType) && ($filter === null || isset($filter['inputType']))) {
			$output .= "\x12";
			$output .= Binary::encodeVarint(strlen($object->inputType));
			$output .= $object->inputType;
		}

		if (isset($object->outputType) && ($filter === null || isset($filter['outputType']))) {
			$output .= "\x1a";
			$output .= Binary::encodeVarint(strlen($object->outputType));
			$output .= $object->outputType;
		}

		if (isset($object->options) && ($filter === null || isset($filter['options']))) {
			$output .= "\x22";
			$buffer = MethodOptionsMeta::toProtobuf($object->options, $filter === null ? null : $filter['options']);
			$output .= Binary::encodeVarint(strlen($buffer));
			$output .= $buffer;
		}

		if (isset($object->clientStreaming) && ($filter === null || isset($filter['clientStreaming']))) {
			$output .= "\x28";
			$output .= Binary::encodeVarint((int)$object->clientStreaming);
		}

		if (isset($object->serverStreaming) && ($filter === null || isset($filter['serverStreaming']))) {
			$output .= "\x30";
			$output .= Binary::encodeVarint((int)$object->serverStreaming);
		}

		return $output;
	}