Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function validateSelf()
 {
     parent::validateSelf();
     if (empty($this->msg)) {
         throw new InvalidArgumentException('msg must be set.');
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function validateSelf()
 {
     parent::validateSelf();
     foreach ($this->properties as $prop) {
         if (empty($this->{$prop})) {
             throw new InvalidArgumentException("{$prop} can not be null");
         }
     }
 }
Example #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;
 }
Example #4
0
 /**
  * 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'];
 }