| @@ 350-370 (lines=21) @@ | ||
| 347 | return $array; |
|
| 348 | } |
|
| 349 | ||
| 350 | public function unpackArrayHeader() |
|
| 351 | { |
|
| 352 | if (!isset($this->buffer[$this->offset])) { |
|
| 353 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
| 354 | } |
|
| 355 | ||
| 356 | $c = \ord($this->buffer[$this->offset]); |
|
| 357 | ++$this->offset; |
|
| 358 | ||
| 359 | if ($c >= 0x90 && $c <= 0x9f) { |
|
| 360 | return $c & 0xf; |
|
| 361 | } |
|
| 362 | if (0xdc === $c) { |
|
| 363 | return $this->unpackUint16(); |
|
| 364 | } |
|
| 365 | if (0xdd === $c) { |
|
| 366 | return $this->unpackUint32(); |
|
| 367 | } |
|
| 368 | ||
| 369 | throw UnpackingFailedException::unexpectedCode($c, 'array header'); |
|
| 370 | } |
|
| 371 | ||
| 372 | public function unpackMap() |
|
| 373 | { |
|
| @@ 384-404 (lines=21) @@ | ||
| 381 | return $map; |
|
| 382 | } |
|
| 383 | ||
| 384 | public function unpackMapHeader() |
|
| 385 | { |
|
| 386 | if (!isset($this->buffer[$this->offset])) { |
|
| 387 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
| 388 | } |
|
| 389 | ||
| 390 | $c = \ord($this->buffer[$this->offset]); |
|
| 391 | ++$this->offset; |
|
| 392 | ||
| 393 | if ($c >= 0x80 && $c <= 0x8f) { |
|
| 394 | return $c & 0xf; |
|
| 395 | } |
|
| 396 | if (0xde === $c) { |
|
| 397 | return $this->unpackUint16(); |
|
| 398 | } |
|
| 399 | if (0xdf === $c) { |
|
| 400 | return $this->unpackUint32(); |
|
| 401 | } |
|
| 402 | ||
| 403 | throw UnpackingFailedException::unexpectedCode($c, 'map header'); |
|
| 404 | } |
|
| 405 | ||
| 406 | public function unpackExt() |
|
| 407 | { |
|