Skip to content

Commit 69c5d59

Browse files
committed
Merge branch '1.0'
2 parents acd13cb + a828f8c commit 69c5d59

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

src/PushbulletMessage.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,31 @@ public function url($url)
144144
public function toArray()
145145
{
146146
$payload = [
147-
'target' => $this->target->getTarget(),
148147
'type' => $this->type,
149148
'title' => $this->title,
150149
'body' => $this->message,
151150
];
152151

153-
if ($this->type === static::TYPE_LINK) {
154-
$payload['url'] = $this->url;
155-
}
152+
return array_merge(
153+
$payload,
154+
$this->target->getTarget(),
155+
$this->getUrlParameter()
156+
);
157+
}
158+
159+
/**
160+
* @return bool
161+
*/
162+
private function isLink()
163+
{
164+
return $this->type === static::TYPE_LINK;
165+
}
156166

157-
return $payload;
167+
/**
168+
* @return array
169+
*/
170+
private function getUrlParameter()
171+
{
172+
return $this->isLink() ? ['url' => $this->url] : [];
158173
}
159174
}

0 commit comments

Comments
 (0)