Beispiel #1
0
 function testUnregisterDefaultCodec()
 {
     $result = Protobuf::unregisterCodec('default');
     $this->assertTrue($result);
     // Ensure a new default is given
     $getted = Protobuf::getCodec();
     $this->assertInstanceOf('DrSlump\\Protobuf\\Codec\\Binary', $getted);
 }
Beispiel #2
0
 /**
  * Serialize the current object data
  *
  * @param CodecInterface|null $codec
  * @return string
  */
 public function serialize(Protobuf\CodecInterface $codec = null)
 {
     $codec = Protobuf::getCodec($codec);
     return $codec->encode($this);
 }