Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
usernane committed Mar 6, 2018
1 parent 6591bac commit 59ee095
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions JsonX.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* An interface for any object that can be represented in JSON notation. The class
* follows the specifications found at https://www.json.org/index.html.
* @author Ibrahim <[email protected]>
* @since 1.1
* @since 1.2
*/
class JsonX {
/**
Expand Down Expand Up @@ -176,32 +176,37 @@ private function parseArray($value){
else{
$comma = ', ';
}
$valueType = gettype($value[$x]);
if($valueType == 'integr' || $valueType == 'double'){
if(is_nan($value[$x])){
$arr .= '"NAN"'.$comma;
}
else if($value[$x] == INF){
$arr .= '"INF"'.$comma;
if($value[$x] instanceof JsonI){
$arr .= $value[$x]->toJSON().$comma;
}
else{
$valueType = gettype($value[$x]);
if($valueType == 'integr' || $valueType == 'double'){
if(is_nan($value[$x])){
$arr .= '"NAN"'.$comma;
}
else if($value[$x] == INF){
$arr .= '"INF"'.$comma;
}
else{
$arr .= $value[$x].$comma;
}
}
else{
$arr .= $value[$x].$comma;
else if($valueType == 'string'){
$arr .= '"'.JsonX::escapeJSONSpecialChars($value[$x]).'"'.$comma;
}
}
else if($valueType == 'string'){
$arr .= '"'.JsonX::escapeJSONSpecialChars($value[$x]).'"'.$comma;
}
else if($valueType == 'boolean'){
if($value[$x] == TRUE){
$arr .= 'true'.$comma;
else if($valueType == 'boolean'){
if($value[$x] == TRUE){
$arr .= 'true'.$comma;
}
else{
$arr .= 'false'.$comma;
}
}
else{
$arr .= 'false'.$comma;
else if($valueType == 'array'){
$arr .= $this->parseArray($value[$x]);
}
}
else if($valueType == 'array'){
$arr .= $this->parseArray($value[$x]);
}
}
$arr.= ']';
return $arr;
Expand Down

0 comments on commit 59ee095

Please sign in to comment.