Fixed static call

This commit is contained in:
Tim Schwartz
2021-06-05 07:58:48 -05:00
parent 4bb1e2c600
commit c7765dad30

View File

@@ -18,7 +18,7 @@ class Snappy
public static function compress($payload)
{
$this->checkSnappy();
self::checkSnappy();
$result = snappy_compress($payload);
if($result === FALSE)
{
@@ -30,11 +30,18 @@ class Snappy
public static function uncompress($payload)
{
$this->checkSnappy();
$result = snappy_uncompress($payload);
$message = "Packet header indicates snappy compression, but snappy was unable to uncompress the data.";
self::checkSnappy();
try {
$result = snappy_uncompress($payload);
} catch (\Exception $e) {
throw new \Exception($message);
}
if($result === FALSE)
{
$message = "Packet header indicates snappy compression, but snappy was unable to uncompress the data.";
throw new \Exception($message);
}
return $result;