| @@ 359-374 (lines=16) @@ | ||
| 356 | return $str; |
|
| 357 | } |
|
| 358 | ||
| 359 | public function unpackArrayLength() |
|
| 360 | { |
|
| 361 | $c = $this->unpackUint8(); |
|
| 362 | ||
| 363 | if ($c >= 0x90 && $c <= 0x9f) { |
|
| 364 | return $c & 0xf; |
|
| 365 | } |
|
| 366 | if (0xdc === $c) { |
|
| 367 | return $this->unpackUint16(); |
|
| 368 | } |
|
| 369 | if (0xdd === $c) { |
|
| 370 | return $this->unpackUint32(); |
|
| 371 | } |
|
| 372 | ||
| 373 | throw new UnpackingFailedException(\sprintf('Unknown array header code: 0x%x.', $c)); |
|
| 374 | } |
|
| 375 | ||
| 376 | public function unpackArray($size) |
|
| 377 | { |
|
| @@ 386-401 (lines=16) @@ | ||
| 383 | return $array; |
|
| 384 | } |
|
| 385 | ||
| 386 | public function unpackMapLength() |
|
| 387 | { |
|
| 388 | $c = $this->unpackUint8(); |
|
| 389 | ||
| 390 | if ($c >= 0x80 && $c <= 0x8f) { |
|
| 391 | return $c & 0xf; |
|
| 392 | } |
|
| 393 | if (0xde === $c) { |
|
| 394 | return $this->unpackUint16(); |
|
| 395 | } |
|
| 396 | if (0xdf === $c) { |
|
| 397 | return $this->unpackUint32(); |
|
| 398 | } |
|
| 399 | ||
| 400 | throw new UnpackingFailedException(\sprintf('Unknown map header code: 0x%x.', $c)); |
|
| 401 | } |
|
| 402 | ||
| 403 | public function unpackMap($size) |
|
| 404 | { |
|