for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace MessagePack\Exception;
use MessagePack\MessagePackException;
use RuntimeException;
use function strlen;
final class InsufficientData extends RuntimeException implements MessagePackException
{
/** @var mixed */
private $value;
public static function fromOffset(string $buffer, int $offset, int $expectedLength): self
$actualLength = strlen($buffer) - $offset;
return new self(
$buffer,
"Not enough data to decode: expected length bytes ${expectedLength}, got ${actualLength}"
);
}
public function getValue()
return $this->value;
private function __construct($value, string $message)
parent::__construct($message);
$this->value = $value;