Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
25 changes: 15 additions & 10 deletions src/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ class Decoder
*/
protected $decodeType;

/**
* @var $_tokenValue
*/
protected $tokenValue;

/**
* Constructor
*
Expand Down Expand Up @@ -143,7 +148,7 @@ protected function _decodeValue()
{
switch ($this->token) {
case self::DATUM:
$result = $this->_tokenValue;
$result = $this->tokenValue;
$this->_getNextToken();
return($result);
break;
Expand Down Expand Up @@ -180,11 +185,11 @@ protected function _decodeObject()
$tok = $this->_getNextToken();

while ($tok && $tok != self::RBRACE) {
if ($tok != self::DATUM || ! is_string($this->_tokenValue)) {
if ($tok != self::DATUM || ! is_string($this->tokenValue)) {
throw new RuntimeException('Missing key in object encoding: ' . $this->source);
}

$key = $this->_tokenValue;
$key = $this->tokenValue;
$tok = $this->_getNextToken();

if ($tok != self::COLON) {
Expand Down Expand Up @@ -288,7 +293,7 @@ protected function _eatWhitespace()
protected function _getNextToken()
{
$this->token = self::EOF;
$this->_tokenValue = null;
$this->tokenValue = null;
$this->_eatWhitespace();

if ($this->offset >= $this->sourceLength) {
Expand Down Expand Up @@ -374,28 +379,28 @@ protected function _getNextToken()
} while ($i < $str_length);

$this->token = self::DATUM;
//$this->_tokenValue = substr($str, $start + 1, $i - $start - 1);
$this->_tokenValue = $result;
//$this->tokenValue = substr($str, $start + 1, $i - $start - 1);
$this->tokenValue = $result;
break;
case 't':
if (($i+ 3) < $str_length && substr($str, $start, 4) == "true") {
$this->token = self::DATUM;
}
$this->_tokenValue = true;
$this->tokenValue = true;
$i += 3;
break;
case 'f':
if (($i+ 4) < $str_length && substr($str, $start, 5) == "false") {
$this->token = self::DATUM;
}
$this->_tokenValue = false;
$this->tokenValue = false;
$i += 4;
break;
case 'n':
if (($i+ 3) < $str_length && substr($str, $start, 4) == "null") {
$this->token = self::DATUM;
}
$this->_tokenValue = NULL;
$this->tokenValue = NULL;
$i += 3;
break;
}
Expand All @@ -418,7 +423,7 @@ protected function _getNextToken()
} else {
$val = intval($datum);
$fVal = floatval($datum);
$this->_tokenValue = ($val == $fVal ? $val : $fVal);
$this->tokenValue = ($val == $fVal ? $val : $fVal);
}
} else {
throw new RuntimeException("Illegal number format: {$datum}");
Expand Down
9 changes: 7 additions & 2 deletions src/Server/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class Response
*/
protected $version;

/**
* @var $args
*/
protected $args;

/**
* Set response state
*
Expand Down Expand Up @@ -225,7 +230,7 @@ public function toJson()
*/
public function getArgs()
{
return $this->_args;
return $this->args;
}

/**
Expand All @@ -236,7 +241,7 @@ public function getArgs()
*/
public function setArgs($args)
{
$this->_args = $args;
$this->args = $args;
return $this;
}

Expand Down

0 comments on commit e630f51

Please sign in to comment.