本文整理汇总了PHP中Vehicle::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle::read方法的具体用法?PHP Vehicle::read怎么用?PHP Vehicle::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle::read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
public function read(TProtocol $input)
{
$xfer = 0;
$fname = null;
$ftype = 0;
$fid = 0;
$xfer += $input->readStructBegin($fname);
while (true) {
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
if ($ftype == TType::STOP) {
break;
}
if (!$fid && $fname !== null) {
if (isset(self::$_TFIELDMAP[$fname])) {
$fid = self::$_TFIELDMAP[$fname];
$ftype = self::$_TSPEC[$fid]['type'];
}
}
switch ($fid) {
case 1:
if ($ftype == TType::I64) {
$xfer += $input->readI64($this->id);
} else {
$xfer += $input->skip($ftype);
}
break;
case 2:
if ($ftype == TType::STRING) {
$xfer += $input->readString($this->name);
} else {
$xfer += $input->skip($ftype);
}
break;
case 3:
if ($ftype == TType::I16) {
$xfer += $input->readI16($this->age);
} else {
$xfer += $input->skip($ftype);
}
break;
case 4:
if ($ftype == TType::STRING) {
$xfer += $input->readString($this->address);
} else {
$xfer += $input->skip($ftype);
}
break;
case 5:
if ($ftype == TType::STRUCT) {
$this->favoriteColor = new Color();
$xfer += $this->favoriteColor->read($input);
} else {
$xfer += $input->skip($ftype);
}
break;
case 6:
if ($ftype == TType::SET) {
$this->friends = array();
$_size0 = 0;
$_etype3 = 0;
$xfer += $input->readSetBegin($_etype3, $_size0);
for ($_i4 = 0; $_size0 === null || $_i4 < $_size0; ++$_i4) {
if ($_size0 === null && !$input->readSetHasNext()) {
break;
}
$elem5 = null;
$xfer += $input->readI64($elem5);
$this->friends[$elem5] = true;
}
$xfer += $input->readSetEnd();
} else {
$xfer += $input->skip($ftype);
}
break;
case 7:
if ($ftype == TType::I64) {
$xfer += $input->readI64($this->bestFriend);
} else {
$xfer += $input->skip($ftype);
}
break;
case 8:
if ($ftype == TType::MAP) {
$this->petNames = array();
$_size6 = 0;
$_ktype7 = 0;
$_vtype8 = 0;
$xfer += $input->readMapBegin($_ktype7, $_vtype8, $_size6);
for ($_i10 = 0; $_size6 === null || $_i10 < $_size6; ++$_i10) {
if ($_size6 === null && !$input->readMapHasNext()) {
break;
}
$key11 = 0;
$val12 = '';
$xfer += $input->readI32($key11);
$xfer += $input->readString($val12);
$this->petNames[$key11] = $val12;
}
$xfer += $input->readMapEnd();
} else {
//.........这里部分代码省略.........