| @@ 403-423 (lines=21) @@ | ||
| 400 | return $array; |
|
| 401 | } |
|
| 402 | ||
| 403 | public function unpackArrayHeader() |
|
| 404 | { |
|
| 405 | if (!isset($this->buffer[$this->offset])) { |
|
| 406 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
| 407 | } |
|
| 408 | ||
| 409 | $c = \ord($this->buffer[$this->offset]); |
|
| 410 | ++$this->offset; |
|
| 411 | ||
| 412 | if ($c >= 0x90 && $c <= 0x9f) { |
|
| 413 | return $c & 0xf; |
|
| 414 | } |
|
| 415 | if (0xdc === $c) { |
|
| 416 | return $this->unpackUint16(); |
|
| 417 | } |
|
| 418 | if (0xdd === $c) { |
|
| 419 | return $this->unpackUint32(); |
|
| 420 | } |
|
| 421 | ||
| 422 | throw UnpackingFailedException::unexpectedCode($c, 'array header'); |
|
| 423 | } |
|
| 424 | ||
| 425 | public function unpackMap() |
|
| 426 | { |
|
| @@ 437-457 (lines=21) @@ | ||
| 434 | return $map; |
|
| 435 | } |
|
| 436 | ||
| 437 | public function unpackMapHeader() |
|
| 438 | { |
|
| 439 | if (!isset($this->buffer[$this->offset])) { |
|
| 440 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
| 441 | } |
|
| 442 | ||
| 443 | $c = \ord($this->buffer[$this->offset]); |
|
| 444 | ++$this->offset; |
|
| 445 | ||
| 446 | if ($c >= 0x80 && $c <= 0x8f) { |
|
| 447 | return $c & 0xf; |
|
| 448 | } |
|
| 449 | if (0xde === $c) { |
|
| 450 | return $this->unpackUint16(); |
|
| 451 | } |
|
| 452 | if (0xdf === $c) { |
|
| 453 | return $this->unpackUint32(); |
|
| 454 | } |
|
| 455 | ||
| 456 | throw UnpackingFailedException::unexpectedCode($c, 'map header'); |
|
| 457 | } |
|
| 458 | ||
| 459 | public function unpackExt() |
|
| 460 | { |
|