1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php namespace DrSlump\Protobuf\Codec; use DrSlump\Protobuf; /** * This codec serializes and unserializes from/to Json strings * where the keys represent the field's tag numbers. * * It makes use of the PhpArray codec to do the heavy work to just * take care of converting the array to/from Json strings. */ class JsonTagMap extends Json implements Protobuf\CodecInterface { public function __construct() { // Setup the codec to use tag numbers as keys $this->useTagNumberAsKey(true); } } |