You are here

public function RecipientGatewayEvent::removeGateway in SMS Framework 2.1.x

Same name and namespace in other branches
  1. 8 src/Event/RecipientGatewayEvent.php \Drupal\sms\Event\RecipientGatewayEvent::removeGateway()
  2. 2.x src/Event/RecipientGatewayEvent.php \Drupal\sms\Event\RecipientGatewayEvent::removeGateway()

Remove a gateway from this event.

Parameters

string $gateway_id: A gateway plugin ID.

int|null $priority: The priority of the gateway to remove, or NULL to remove all gateways with the identifier.

Return value

$this Return this event for chaining.

File

src/Event/RecipientGatewayEvent.php, line 131

Class

RecipientGatewayEvent
Event fired to determine valid gateways for a recipient.

Namespace

Drupal\sms\Event

Code

public function removeGateway($gateway_id, $priority = NULL) {
  foreach ($this->gateways as $k => $tuple) {
    list($gateway, $gateway_priority) = $tuple;
    if ($gateway_id == $gateway
      ->id()) {
      if (!isset($priority) || $priority == $gateway_priority) {
        unset($this->gateways[$k]);
      }
    }
  }
  return $this;
}