コード例 #1
0
ファイル: Text.php プロジェクト: lichunqiang/easemob
 /**
  * {@inheritdoc}
  */
 protected function validateSelf()
 {
     parent::validateSelf();
     if (empty($this->msg)) {
         throw new InvalidArgumentException('msg must be set.');
     }
 }
コード例 #2
0
ファイル: Voice.php プロジェクト: lichunqiang/easemob
 /**
  * {@inheritdoc}
  */
 protected function validateSelf()
 {
     parent::validateSelf();
     foreach ($this->properties as $prop) {
         if (empty($this->{$prop})) {
             throw new InvalidArgumentException("{$prop} can not be null");
         }
     }
 }
コード例 #3
0
 public function build()
 {
     $data = ['target_type' => $this->targetType, 'target' => (array) $this->to, 'msg' => $this->msg->toArray(), 'from' => $this->from, 'ext' => $this->ext];
     $this->validate($data);
     return $data;
 }
コード例 #4
0
ファイル: Message.php プロジェクト: lichunqiang/easemob
 /**
  * Send a message.
  *
  * @param Msg $msg
  *
  * @return mixed This will return the data field.
  */
 public function send(Msg $msg)
 {
     $response = $this->http->post('messages', $msg->build());
     return $this->parseResponse($response)['data'];
 }