/** * Converts access property data to json string * @return string */ function toJSON() { if ($this instanceof Enumerable) { return JSONUtil::encode($this->toArray()); } $property = defined('static::$DOMAIN_PROPERTY') ? static::$DOMAIN_PROPERTY : 'data'; if (!isset($this->{$property})) { $this->{$property} = []; } return JSONUtil::encode($this->{$property}); }
public function __toString() { return \qtil\JSONUtil::encode(['id' => $this->getID(), 'data' => $this->data]); }