Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 public function testAlertPayloadSendsOnlyBody()
 {
     $alert = new Alert('Foo wants Bar');
     $payload = $alert->getPayload();
     $this->assertEquals('Foo wants Bar', $payload);
 }