| 382 | } |
| 383 | |
| 384 | public function readFieldBegin(&$name, &$field_type, &$field_id) |
| 385 | { |
| 386 | $result = $this->readUByte($compact_type_and_delta); |
| 387 | |
| 388 | $compact_type = $compact_type_and_delta & 0x0f; |
| 389 | |
| 390 | if ($compact_type == TType::STOP) { |
| 391 | $field_type = $compact_type; |
| 392 | $field_id = 0; |
| 393 | |
| 394 | return $result; |
| 395 | } |
| 396 | $delta = $compact_type_and_delta >> 4; |
| 397 | if ($delta == 0) { |
| 398 | $result += $this->readI16($field_id); |
| 399 | } else { |
| 400 | $field_id = $this->lastFid + $delta; |
| 401 | } |
| 402 | $this->lastFid = $field_id; |
| 403 | $field_type = $this->getTType($compact_type); |
| 404 | |
| 405 | if ($compact_type == TCompactProtocol::COMPACT_TRUE) { |
| 406 | $this->state = TCompactProtocol::STATE_BOOL_READ; |
| 407 | $this->boolValue = true; |
| 408 | } elseif ($compact_type == TCompactProtocol::COMPACT_FALSE) { |
| 409 | $this->state = TCompactProtocol::STATE_BOOL_READ; |
| 410 | $this->boolValue = false; |
| 411 | } else { |
| 412 | $this->state = TCompactProtocol::STATE_VALUE_READ; |
| 413 | } |
| 414 | |
| 415 | return $result; |
| 416 | } |
| 417 | |
| 418 | public function readFieldEnd() |
| 419 | { |