asSmsMessage example

use Symfony\Component\Notifier\Recipient\SmsRecipientInterface;

/** * @author Fabien Potencier <fabien@symfony.com> */
class SmsChannel extends AbstractChannel
{
    public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
    {
        $message = null;
        if ($notification instanceof SmsNotificationInterface) {
            $message = $notification->asSmsMessage($recipient$transportName);
        }

        $message ??= SmsMessage::fromNotification($notification$recipient);

        if (null !== $transportName) {
            $message->transport($transportName);
        }

        if (null === $this->bus) {
            $this->transport->send($message);
        } else {
            
Home | Imprint | This part of the site doesn't use cookies.