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

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

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

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

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

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

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

		if (isset($object->uninterpretedOption) && ($filter === null || isset($filter['uninterpretedOption']))) {
			foreach ($object->uninterpretedOption instanceof \Traversable ? $object->uninterpretedOption : (array)$object->uninterpretedOption as $k => $v) {
				$output .= "\xba\x3e";
				$buffer = UninterpretedOptionMeta::toProtobuf($v, $filter === null ? null : $filter['uninterpretedOption']);
				$output .= Binary::encodeVarint(strlen($buffer));
				$output .= $buffer;
			}
		}

		return $output;
	}