You are here

abstract class AcsfEventHandler in Acquia Cloud Site Factory Connector 8.2

Same name and namespace in other branches
  1. 8 src/Event/AcsfEventHandler.php \Drupal\acsf\Event\AcsfEventHandler

AcsfEventHandler.

The purpose of this class is to define an interface for events within Site Factory. Customers who have access to customize their code base can write client code to this interface to interact with events in a standardized way.

Hierarchy

Expanded class hierarchy of AcsfEventHandler

4 files declare their use of AcsfEventHandler
UnitTestDummyHandler1.php in tests/UnitTestDummyHandler1.php
UnitTestDummyHandler2.php in tests/UnitTestDummyHandler2.php
UnitTestDummyHandler3.php in tests/UnitTestDummyHandler3.php
UnitTestDummyHandlerInterrupt.php in tests/UnitTestDummyHandlerInterrupt.php

File

src/Event/AcsfEventHandler.php, line 12

Namespace

Drupal\acsf\Event
View source
abstract class AcsfEventHandler {

  /**
   * The time that the handler was started.
   *
   * @var int
   */
  public $started = 0;

  /**
   * The time that the handler was completed.
   *
   * @var int
   */
  public $completed = 0;

  /**
   * Any messages triggered by the handler.
   *
   * @var string
   */
  public $message = '';

  /**
   * Constructor.
   *
   * @param AcsfEvent $event
   *   The event that has been initiated.
   */
  public function __construct(AcsfEvent $event) {
    $this->event = $event;
  }

  /**
   * Writes a log message to the console.
   *
   * @param string $message
   *   The log message to be written.
   */
  public function consoleLog($message) {
    if (isset($this->event->output)) {
      $this->event->output
        ->writeln($message);
    }
  }

  /**
   * Handle the event.
   */
  public abstract function handle();

}

Members

Namesort descending Modifiers Type Description Overrides
AcsfEventHandler::$completed public property The time that the handler was completed.
AcsfEventHandler::$message public property Any messages triggered by the handler.
AcsfEventHandler::$started public property The time that the handler was started.
AcsfEventHandler::consoleLog public function Writes a log message to the console.
AcsfEventHandler::handle abstract public function Handle the event. 12
AcsfEventHandler::__construct public function Constructor. 1