| @@ 423-443 (lines=21) @@ | ||
| 420 | return $array; |
|
| 421 | } |
|
| 422 | ||
| 423 | public function unpackArrayHeader() |
|
| 424 | { |
|
| 425 | if (!isset($this->buffer[$this->offset])) { |
|
| 426 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
| 427 | } |
|
| 428 | ||
| 429 | $c = \ord($this->buffer[$this->offset]); |
|
| 430 | ++$this->offset; |
|
| 431 | ||
| 432 | if ($c >= 0x90 && $c <= 0x9f) { |
|
| 433 | return $c & 0xf; |
|
| 434 | } |
|
| 435 | if (0xdc === $c) { |
|
| 436 | return $this->unpackUint16(); |
|
| 437 | } |
|
| 438 | if (0xdd === $c) { |
|
| 439 | return $this->unpackUint32(); |
|
| 440 | } |
|
| 441 | ||
| 442 | throw UnpackingFailedException::unexpectedCode($c, 'array header'); |
|
| 443 | } |
|
| 444 | ||
| 445 | public function unpackMap() |
|
| 446 | { |
|
| @@ 457-477 (lines=21) @@ | ||
| 454 | return $map; |
|
| 455 | } |
|
| 456 | ||
| 457 | public function unpackMapHeader() |
|
| 458 | { |
|
| 459 | if (!isset($this->buffer[$this->offset])) { |
|
| 460 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
| 461 | } |
|
| 462 | ||
| 463 | $c = \ord($this->buffer[$this->offset]); |
|
| 464 | ++$this->offset; |
|
| 465 | ||
| 466 | if ($c >= 0x80 && $c <= 0x8f) { |
|
| 467 | return $c & 0xf; |
|
| 468 | } |
|
| 469 | if (0xde === $c) { |
|
| 470 | return $this->unpackUint16(); |
|
| 471 | } |
|
| 472 | if (0xdf === $c) { |
|
| 473 | return $this->unpackUint32(); |
|
| 474 | } |
|
| 475 | ||
| 476 | throw UnpackingFailedException::unexpectedCode($c, 'map header'); |
|
| 477 | } |
|
| 478 | ||
| 479 | public function unpackExt() |
|
| 480 | { |
|