コード例 #1
0
ファイル: Server.php プロジェクト: ajbrown/bitnotion
 /**
  * Stores a message to the logbank
  *
  * @throws ZForge_LogBank_Exception if API Key is invalid
  * @param string $apiKey An active API key for this account
  * @param ZForge_LogBank_Server_Message the message to store
  * @return string the message id of the inserted message, or false on failure
  */
 public function writeMessage($apiKey, ZForge_LogBank_Server_Message $msg)
 {
     if (!$this->verifyApiKey($apiKey)) {
         require_once 'ZForge/LogBank/Exception.php';
         throw new ZForge_LogBank_Exception('Provided API Key is invalid');
     }
     $msg = $this->_prepareMessage($msg);
     $msg->apiKey = $apiKey;
     $doc = new Phly_Couch_Document($this->_messageToArray($msg));
     $result = $this->_couch->docSave($doc);
     return $result->id;
 }