/** * Serializes type */ public function SerializeToString($rec = -1) { // now convert signed int to int $save = $this->value; if ($this->value < 0) { $this->value = abs($this->value) * 2 - 1; } else { $this->value = $this->value * 2; } $string = parent::SerializeToString($rec); // restore value $this->value = $save; return $string; }