* The skip function is a utility to parse over unrecognized date without * causing corruption. * * @param int $type What type is it (defined in TType::class) */
($type)
| 188 | * @param int $type What type is it (defined in TType::class) |
| 189 | */ |
| 190 | public function skip($type) |
| 191 | { |
| 192 | switch ($type) { |
| 193 | case TType::BOOL: |
| 194 | return $this->readBool($bool); |
| 195 | case TType::BYTE: |
| 196 | return $this->readByte($byte); |
| 197 | case TType::I16: |
| 198 | return $this->readI16($i16); |
| 199 | case TType::I32: |
| 200 | return $this->readI32($i32); |
| 201 | case TType::I64: |
| 202 | return $this->readI64($i64); |
| 203 | case TType::DOUBLE: |
| 204 | return $this->readDouble($dub); |
| 205 | case TType::STRING: |
| 206 | return $this->readString($str); |
| 207 | case TType::UUID: |
| 208 | return $this->readUuid($uuid); |
| 209 | case TType::STRUCT: |
| 210 | $result = $this->readStructBegin($name); |
| 211 | while (true) { |
| 212 | $result += $this->readFieldBegin($name, $ftype, $fid); |
| 213 | if ($ftype == TType::STOP) { |
| 214 | break; |
| 215 | } |
| 216 | $result += $this->skip($ftype); |
| 217 | $result += $this->readFieldEnd(); |
| 218 | } |
| 219 | $result += $this->readStructEnd(); |
| 220 | |
| 221 | return $result; |
| 222 | |
| 223 | case TType::MAP: |
| 224 | $result = $this->readMapBegin($keyType, $valType, $size); |
| 225 | for ($i = 0; $i < $size; $i++) { |
| 226 | $result += $this->skip($keyType); |
| 227 | $result += $this->skip($valType); |
| 228 | } |
| 229 | $result += $this->readMapEnd(); |
| 230 | |
| 231 | return $result; |
| 232 | |
| 233 | case TType::SET: |
| 234 | $result = $this->readSetBegin($elemType, $size); |
| 235 | for ($i = 0; $i < $size; $i++) { |
| 236 | $result += $this->skip($elemType); |
| 237 | } |
| 238 | $result += $this->readSetEnd(); |
| 239 | |
| 240 | return $result; |
| 241 | |
| 242 | case TType::LST: |
| 243 | $result = $this->readListBegin($elemType, $size); |
| 244 | for ($i = 0; $i < $size; $i++) { |
| 245 | $result += $this->skip($elemType); |
| 246 | } |
| 247 | $result += $this->readListEnd(); |