Skip to content

Commit

Permalink
More tests and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zloyuser authored Jan 18, 2019
1 parent 8c8cb18 commit be77a86
Show file tree
Hide file tree
Showing 16 changed files with 651 additions and 387 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/Buffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public function appendTable(array $table): self
$buffer = new static;

foreach ($table as $k => $v) {
$k = (string) $k;

$buffer->appendUint8(\strlen($k));
$buffer->append($k);
$buffer->appendValue($v);
Expand Down Expand Up @@ -203,7 +205,7 @@ public function consumeDecimal(): int
$scale = $this->consumeUint8();
$value = $this->consumeUint32();

return $value * \pow(10, $scale);
return $value * (10 ** $scale);
}

/**
Expand Down Expand Up @@ -237,7 +239,7 @@ private function consumeValue()
return $this->consumeFloat();
case Constants::FIELD_DOUBLE:
return $this->consumeDouble();
case Constants::FIELD_DECIMAL_VALUE:
case Constants::FIELD_DECIMAL:
return $this->consumeDecimal();
case Constants::FIELD_SHORT_STRING:
return $this->consume($this->consumeUint8());
Expand Down
Loading

0 comments on commit be77a86

Please sign in to comment.