\NotificationSmsMessageMediaProvider
Notification provider used to send an SMS Message Media via an Email message.
If `giggsey/libphonenumber-for-php` is available. The mobile phone number will be validated before trying to send
the SMS.
Synopsis
class NotificationSmsMessageMediaProvider
implements
NotificationProviderInterface
{
- // members
- protected $destinationDomain;
- protected $fromEmail;
- protected $phoneNumberField;
- protected $defaultCountry;
- private boolean $forceBasicPhoneParsing = false;
- // methods
- public void __construct()
- public NotificationDelivery send()
- protected string buildMessage()
- protected string getPhoneNumber()
- protected string basicPhoneParsing()
- protected string advancedPhoneParsing()
- public void setForceBasicPhoneParsing()
Hierarchy
Implements
Members
private
- $forceBasicPhoneParsing
—
boolean
Test flag to force the use of Basic Phone Parsing even if if the PhoneNumberUtil library is installed.
protected
- $defaultCountry — string
- $destinationDomain — string
- $fromEmail — string
- $phoneNumberField — string
Methods
protected
- advancedPhoneParsing() — Advanced Phone parsing that uses `PhoneNumberUtil`. It will try to parse the phone number. It will attempt to determine the right country code and to identifiy if the number is for a mobile phone or a landline.
- basicPhoneParsing() — Basic phone validation in case PhoneNumberUtil is not available. This does not validate the phone beyond removing all non-digit characters and making sure the phone string is non-empty.
- buildMessage() — Build an SMS message by appending the call to action URL if provided. The call to action URL will be made absolute if it isn't already.
- getPhoneNumber() — Try to get a mobile phone number for a member.
public
- __construct() — Instanciate this NotificationSmsMessageMediaProvider.
- send()
- setForceBasicPhoneParsing() — Set the value `ForceBasicPhoneParsing` flag. The default behavior is to use `giggsey/libphonenumber-for-php` library if it's installed. Using this flag you can test the logic for when the library is missing. This is meant for testing only.