コード例 #1
0
ファイル: Message.php プロジェクト: Alex--Jin/homerapi
 /**
  * Get Payload
  * Generate APN array.
  *
  * @return array
  */
 public function getPayload()
 {
     $message = array();
     $aps = array();
     if ($this->alert && ($alert = $this->alert->getPayload())) {
         $aps['alert'] = $alert;
     }
     if (!is_null($this->badge)) {
         $aps['badge'] = $this->badge;
     }
     if (!is_null($this->sound)) {
         $aps['sound'] = $this->sound;
     }
     if (!is_null($this->contentAvailable)) {
         $aps['content-available'] = $this->contentAvailable;
     }
     if (!is_null($this->category)) {
         $aps['category'] = $this->category;
     }
     if (!is_null($this->urlArgs)) {
         $aps['url-args'] = $this->urlArgs;
     }
     if (!empty($this->custom)) {
         $message = array_merge($this->custom, $message);
     }
     if (!empty($aps)) {
         $message['aps'] = $aps;
     }
     return $message;
 }
コード例 #2
0
ファイル: Message.php プロジェクト: im286er/ent
 /**
  * Get Payload
  * Generate APN array.
  *
  * @return array
  */
 public function getPayload()
 {
     $message = array();
     $message['aps'] = array();
     if ($this->alert && ($alert = $this->alert->getPayload())) {
         $message['aps']['alert'] = $alert;
     }
     if (!is_null($this->badge)) {
         $message['aps']['badge'] = $this->badge;
     }
     if (!is_null($this->sound)) {
         $message['aps']['sound'] = $this->sound;
     }
     if (!empty($this->custom)) {
         $message = array_merge($this->custom, $message);
     }
     return $message;
 }
コード例 #3
0
 public function testAlertPayloadSendsOnlyBody()
 {
     $alert = new Alert('Foo wants Bar');
     $payload = $alert->getPayload();
     $this->assertEquals('Foo wants Bar', $payload);
 }