public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('TTypeEntry'); if ($this->primitiveEntry !== null) { if (!is_object($this->primitiveEntry)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('primitiveEntry', TType::STRUCT, 1); $xfer += $this->primitiveEntry->write($output); $xfer += $output->writeFieldEnd(); } if ($this->arrayEntry !== null) { if (!is_object($this->arrayEntry)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('arrayEntry', TType::STRUCT, 2); $xfer += $this->arrayEntry->write($output); $xfer += $output->writeFieldEnd(); } if ($this->mapEntry !== null) { if (!is_object($this->mapEntry)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('mapEntry', TType::STRUCT, 3); $xfer += $this->mapEntry->write($output); $xfer += $output->writeFieldEnd(); } if ($this->structEntry !== null) { if (!is_object($this->structEntry)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('structEntry', TType::STRUCT, 4); $xfer += $this->structEntry->write($output); $xfer += $output->writeFieldEnd(); } if ($this->unionEntry !== null) { if (!is_object($this->unionEntry)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('unionEntry', TType::STRUCT, 5); $xfer += $this->unionEntry->write($output); $xfer += $output->writeFieldEnd(); } if ($this->userDefinedTypeEntry !== null) { if (!is_object($this->userDefinedTypeEntry)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('userDefinedTypeEntry', TType::STRUCT, 6); $xfer += $this->userDefinedTypeEntry->write($output); $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; }
public function __construct($vals = null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array(1 => array('var' => 'typeClassName', 'type' => TType::STRING)); } if (is_array($vals)) { if (isset($vals['typeClassName'])) { $this->typeClassName = $vals['typeClassName']; } } }