class SmsEntityPhoneNumber in SMS Framework 8
Same name and namespace in other branches
- 2.x src/Event/SmsEntityPhoneNumber.php \Drupal\sms\Event\SmsEntityPhoneNumber
- 2.1.x src/Event/SmsEntityPhoneNumber.php \Drupal\sms\Event\SmsEntityPhoneNumber
Event fired when resolving phone numbers for an entity.
Hierarchy
- class \Drupal\sms\Event\SmsEntityPhoneNumber extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of SmsEntityPhoneNumber
See also
2 files declare their use of SmsEntityPhoneNumber
- PhoneNumberProvider.php in src/
Provider/ PhoneNumberProvider.php - SmsEntityPhoneNumberProcessor.php in src/
EventSubscriber/ SmsEntityPhoneNumberProcessor.php
File
- src/
Event/ SmsEntityPhoneNumber.php, line 13
Namespace
Drupal\sms\EventView source
class SmsEntityPhoneNumber extends Event {
/**
* The entity to find phone numbers.
*
* @var \Drupal\Core\Entity\EntityInterface
*/
protected $entity;
/**
* Whether the returned phone numbers must be verified.
*
* Use NULL to get all phone numbers regardless of status.
*
* @var bool|null
*/
protected $verified;
/**
* An array of phone numbers.
*
* @var string[]
*/
protected $phoneNumbers = [];
/**
* Constructs the object.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity to find phone numbers.
* @param bool|null $verified
* Whether the returned phone numbers must be verified, or NULL to get all
* phone numbers regardless of status.
*/
public function __construct(EntityInterface $entity, $verified = TRUE) {
$this->entity = $entity;
$this->verified = $verified;
}
/**
* Get entity to find phone numbers.
*
* @return \Drupal\Core\Entity\EntityInterface
* The entity to find phone numbers.
*/
public function getEntity() {
return $this->entity;
}
/**
* Get phone numbers with this verification state.
*
* @return bool|null
* Whether the returned phone numbers must be verified, or NULL to get all
* phone numbers regardless of status.
*/
public function getRequiresVerification() {
return $this->verified;
}
/**
* Get phone number on this event.
*
* @return string[]
* The phone number on this event.
*/
public function getPhoneNumbers() {
return $this->phoneNumbers;
}
/**
* Add phone number to this event.
*
* @param string $phone_number
* A phone number to add to this event.
*
* @return $this
* Return this event for chaining.
*/
public function addPhoneNumber($phone_number) {
if (!in_array($phone_number, $this->phoneNumbers)) {
$this->phoneNumbers[] = $phone_number;
}
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SmsEntityPhoneNumber:: |
protected | property | The entity to find phone numbers. | |
SmsEntityPhoneNumber:: |
protected | property | An array of phone numbers. | |
SmsEntityPhoneNumber:: |
protected | property | Whether the returned phone numbers must be verified. | |
SmsEntityPhoneNumber:: |
public | function | Add phone number to this event. | |
SmsEntityPhoneNumber:: |
public | function | Get entity to find phone numbers. | |
SmsEntityPhoneNumber:: |
public | function | Get phone number on this event. | |
SmsEntityPhoneNumber:: |
public | function | Get phone numbers with this verification state. | |
SmsEntityPhoneNumber:: |
public | function | Constructs the object. |