Skip to content

Commit

Permalink
little improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
iGusev committed Jun 30, 2015
1 parent 7489f93 commit 7913106
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public function toJson($inner = false)

foreach (static::$map as $key => $item) {
$property = lcfirst(self::toCamelCase($key));
$output[$key] = $item === true ? $this->$property : $this->$property->toJson(true);
if(!is_null($this->$property)) {
$output[$key] = $item === true ? $this->$property : $this->$property->toJson(true);
}
}

return $inner === false ? json_encode($output) : $output;
Expand Down

0 comments on commit 7913106

Please sign in to comment.