You are here

public function AcsfEvent::pushHandler in Acquia Cloud Site Factory Connector 8

Same name and namespace in other branches
  1. 8.2 src/Event/AcsfEvent.php \Drupal\acsf\Event\AcsfEvent::pushHandler()

Pushes a handler to in internal list.

Parameters

AcsfEventHandler $handler: The handler to add.

string $type: The type of handler: incomplete, complete or failed.

Throws

\Drupal\acsf\Event\AcsfEventHandlerIncompatibleException

1 call to AcsfEvent::pushHandler()
AcsfEvent::loadHandlers in src/Event/AcsfEvent.php
Loads event handlers for the appropriate event.

File

src/Event/AcsfEvent.php, line 162

Class

AcsfEvent
ACSFEvent.

Namespace

Drupal\acsf\Event

Code

public function pushHandler(AcsfEventHandler $handler, $type = 'incomplete') {
  if (array_key_exists($type, $this->handlers)) {
    $this->handlers[$type][] = $handler;
  }
  else {
    throw new AcsfEventHandlerIncompatibleException(sprintf('The handler type "%s" is incompatible with this event.', $type));
  }
}