mCommitSucc = 0; $this->mCommitFail = 0; $this->mNotifySucc = 0; $this->mNotifyFail = 0; } public function update(array $data) { $this->mCommitSucc = $data[0]; $this->mCommitFail = $data[1]; $this->mNotifySucc = $data[2]; $this->mNotifyFail = $data[3]; } public function commit_ratio() { $count = $this->mCommitSucc + $this->mCommitFail; if($count > 0) { return [true,$this->mCommitSucc / $count]; } else { return [false,0]; } } public function notify_ratio() { $count = $this->mNotifySucc + $this->mNotifyFail; if($count > 0) { return [true,$this->mCommitSucc / $count]; } else { return [false,0]; } } }