예제 #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]);
 }