Class to aid in the parsing and creating of Protocol Buffer Messages This class should be included by the developer before they use a generated protobuf class.

author Andrew Brampton
package SLS_PHP_SDK

 Methods

Returns a string representing this wiretype

get_wiretype($wire_type) 
Static

Parameters

$wire_type

read_double()

read_double($fp) 
Static

Parameters

$fp

Read a unknown field from the stream and return its raw bytes

read_field($fp, $wire_type, $limit = null
Static

Parameters

$fp

$wire_type

$limit

read_float()

read_float($fp) 
Static

Parameters

$fp

read_int32()

read_int32($fp) 
Static

Parameters

$fp

read_int64()

read_int64($fp) 
Static

Parameters

$fp

read_uint32()

read_uint32($fp) 
Static

Parameters

$fp

read_uint64()

read_uint64($fp) 
Static

Parameters

$fp

Tries to read a varint from $fp.

read_varint($fp, $limit = null
Static
returns the Varint from the stream, or false if the stream has reached eof.

Parameters

$fp

$limit

read_zint32()

read_zint32($fp) 
Static

Parameters

$fp

read_zint64()

read_zint64($fp) 
Static

Parameters

$fp

Returns how big (in bytes) this number would be as a varint

size_varint($i) 
Static

Parameters

$i

Seek past the current field

skip_field($fp, $wire_type) 
Static

Parameters

$fp

$wire_type

Seek past a varint

skip_varint($fp) 
Static

Parameters

$fp

toString()

toString($key, $value) 
Static

Parameters

$key

$value

write_double()

write_double($fp, $d) 
Static

Parameters

$fp

$d

write_float()

write_float($fp, $f) 
Static

Parameters

$fp

$f

write_int32()

write_int32($fp, $i) 
Static

Parameters

$fp

$i

write_int64()

write_int64($fp, $i) 
Static

Parameters

$fp

$i

write_uint32()

write_uint32($fp, $i) 
Static

Parameters

$fp

$i

write_uint64()

write_uint64($fp, $i) 
Static

Parameters

$fp

$i

Writes a varint to $fp returns the number of bytes written

write_varint($fp, $i) : \The
Static

Parameters

$fp

$i

The int to encode

Returns

\Thenumber of bytes written

write_zint32()

write_zint32($fp, $i) 
Static

Parameters

$fp

$i

write_zint64()

write_zint64($fp, $i) 
Static

Parameters

$fp

$i

 Properties

 

$indent_char

$indent_char 

Default

"\t"
Static
 

Used to aid in pretty printing of Protobuf objects

$print_depth 

Default

0
Static
 

$print_limit

$print_limit 

Default

50
Static

 Constants

 

TYPE_BOOL

TYPE_BOOL = 8 
 

TYPE_BYTES

TYPE_BYTES = 12 
 

TYPE_DOUBLE

TYPE_DOUBLE = 1 
 

TYPE_ENUM

TYPE_ENUM = 14 
 

TYPE_FIXED32

TYPE_FIXED32 = 7 
 

TYPE_FIXED64

TYPE_FIXED64 = 6 
 

TYPE_FLOAT

TYPE_FLOAT = 2 
 

TYPE_GROUP

TYPE_GROUP = 10 
 

TYPE_INT32

TYPE_INT32 = 5 
 

TYPE_INT64

TYPE_INT64 = 3 
 

TYPE_MESSAGE

TYPE_MESSAGE = 11 
 

TYPE_SFIXED32

TYPE_SFIXED32 = 15 
 

TYPE_SFIXED64

TYPE_SFIXED64 = 16 
 

TYPE_SINT32

TYPE_SINT32 = 17 
 

TYPE_SINT64

TYPE_SINT64 = 18 
 

TYPE_STRING

TYPE_STRING = 9 
 

TYPE_UINT32

TYPE_UINT32 = 13 
 

TYPE_UINT64

TYPE_UINT64 = 4