WIRED_VARINT
WIRED_VARINT = 0
Abstract Message class
_destruct()
Fix Memory Leaks with Objects in PHP 5 http://paul-m-jones.com/?p=262
thanks to cheton http://code.google.com/p/pb4php/issues/detail?id=3&can=1
<?php
/**
* @author Nikolai Kordulla
*/
class PBBytes extends PBScalar
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
/**
* Parses the message for this type
*
* @param array
*/
public function ParseFromArray()
{
$this->value = '';
// first byte is length
$length = $this->reader->next();
// just extract the string
$pointer = $this->reader->get_pointer();
$this->reader->add_pointer($length);
$this->value = $this->reader->get_message_from($pointer);
}
/**
* Serializes type
*/
public function SerializeToString($rec = -1)
{
$string = '';
if ($rec > -1)
{
$string .= $this->base128->set_value($rec << 3 | $this->wired_type);
}
$string .= $this->base128->set_value(strlen($this->value));
$string .= $this->value;
return $string;
}
}
?>