Skip to content

Commit c464a22

Browse files
[Notifier] Bring consistency to bridges
1 parent 7dc6505 commit c464a22

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

FirebaseTransport.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __toString(): string
4646

4747
public function supports(MessageInterface $message): bool
4848
{
49-
return $message instanceof ChatMessage;
49+
return $message instanceof ChatMessage && (null === $message->getOptions() || $message->getOptions() instanceof FirebaseOptions);
5050
}
5151

5252
protected function doSend(MessageInterface $message): SentMessage
@@ -56,14 +56,12 @@ protected function doSend(MessageInterface $message): SentMessage
5656
}
5757

5858
$endpoint = sprintf('https://%s', $this->getEndpoint());
59-
$options = ($opts = $message->getOptions()) ? $opts->toArray() : [];
60-
if (!isset($options['to'])) {
61-
$options['to'] = $message->getRecipientId();
62-
}
63-
if (null === $options['to']) {
59+
$options = $message->getOptions()?->toArray() ?? [];
60+
$options['to'] = $message->getRecipientId();
61+
62+
if (!$options['to']) {
6463
throw new InvalidArgumentException(sprintf('The "%s" transport required the "to" option to be set.', __CLASS__));
6564
}
66-
$options['notification'] ??= [];
6765
$options['notification']['body'] = $message->getSubject();
6866
$options['data'] ??= [];
6967

0 commit comments

Comments
 (0)