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