class GlobalOptionsEventListener

Namespace

Drush\Command

Hierarchy

Expanded class hierarchy of GlobalOptionsEventListener

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
GlobalOptionsEventListener::getSubscribedEvents public static function @
GlobalOptionsEventListener::setGlobalOptions public function Before a Console command runs, examine the global commandline options from the event Input, and set configuration values as appropriate.

File

lib/Drush/Command/GlobalOptionsEventListener.php, line 9

View source
class GlobalOptionsEventListener implements EventSubscriberInterface {
  /**
   * @{@inheritdoc}
   */
  public static function getSubscribedEvents() {
    // Register our 'setGlobalOptions' command to run prior to
    // command dispatch.
    return [ConsoleEvents::COMMAND 'setGlobalOptions'];
  }

  /**
   * Before a Console command runs, examine the global
   * commandline options from the event Input, and set
   * configuration values as appropriate.
   *
   * @param ConsoleCommandEvent $event
   */
  public function setGlobalOptions(ConsoleCommandEvent $event) {
    /* @var Input $input */
    $input = $event->getInput();

    // TODO: We need a good strategy for managing global options.
    // $simulate = $input->getOption('simulate');
  }
}