fields = array(); } public function vibration($value) { $this->vibration = $value; } public function breathLight($value) { $this->breathLight = $value; } public function getFields() { $result = "{"; foreach ($this->fields as $key => $value) { $result = $result . $key . ":" . json_encode($value) . ","; PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][result:' . $result, Constants::HW_PUSH_LOG_DEBUG_LEVEL); } if (strlen($result) > 1) { $result = rtrim($result, ","); } $result = $result . "}"; return $result; } public function buildFields() { $keys = array( 'vibration', 'breathLight' ); foreach ($keys as $key) { PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][key:' . $key . '][value:' . json_encode($this->$key) . ']', Constants::HW_PUSH_LOG_DEBUG_LEVEL); if (isset($this->$key)) { $this->fields[$key] = $this->$key; } } PushLogConfig::getSingleInstance()->LogMessage('[' . __CLASS__ . '][buildFields result:' . json_encode($this->fields), Constants::HW_PUSH_LOG_DEBUG_LEVEL); } }