@@ 390-410 (lines=21) @@ | ||
387 | return $array; |
|
388 | } |
|
389 | ||
390 | public function unpackArrayHeader() |
|
391 | { |
|
392 | if (!isset($this->buffer[$this->offset])) { |
|
393 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
394 | } |
|
395 | ||
396 | $c = \ord($this->buffer[$this->offset]); |
|
397 | ++$this->offset; |
|
398 | ||
399 | if ($c >= 0x90 && $c <= 0x9f) { |
|
400 | return $c & 0xf; |
|
401 | } |
|
402 | if (0xdc === $c) { |
|
403 | return $this->unpackUint16(); |
|
404 | } |
|
405 | if (0xdd === $c) { |
|
406 | return $this->unpackUint32(); |
|
407 | } |
|
408 | ||
409 | throw UnpackingFailedException::unexpectedCode($c, 'array header'); |
|
410 | } |
|
411 | ||
412 | public function unpackMap() |
|
413 | { |
|
@@ 424-444 (lines=21) @@ | ||
421 | return $map; |
|
422 | } |
|
423 | ||
424 | public function unpackMapHeader() |
|
425 | { |
|
426 | if (!isset($this->buffer[$this->offset])) { |
|
427 | throw InsufficientDataException::unexpectedLength($this->buffer, $this->offset, 1); |
|
428 | } |
|
429 | ||
430 | $c = \ord($this->buffer[$this->offset]); |
|
431 | ++$this->offset; |
|
432 | ||
433 | if ($c >= 0x80 && $c <= 0x8f) { |
|
434 | return $c & 0xf; |
|
435 | } |
|
436 | if (0xde === $c) { |
|
437 | return $this->unpackUint16(); |
|
438 | } |
|
439 | if (0xdf === $c) { |
|
440 | return $this->unpackUint32(); |
|
441 | } |
|
442 | ||
443 | throw UnpackingFailedException::unexpectedCode($c, 'map header'); |
|
444 | } |
|
445 | ||
446 | public function unpackExt() |
|
447 | { |