コード例 #1
0
ファイル: JSONAccess.php プロジェクト: jgswift/qtil
 /**
  * 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});
 }
コード例 #2
0
ファイル: Packet.php プロジェクト: jgswift/qtcp
 public function __toString()
 {
     return \qtil\JSONUtil::encode(['id' => $this->getID(), 'data' => $this->data]);
 }