function DevelEventCommand::askForImplementation

Prompts for an event, and for an implementation, when not given.

Attributes

#[Interact]

File

src/Command/DevelEventCommand.php, line 44

Class

DevelEventCommand
Lists the listeners of an event and opens one in an editor.

Namespace

Drupal\devel\Command

Code

public function askForImplementation(InputInterface $input, OutputInterface $output) : void {
  $io = new SymfonyStyle($input, $output);
  if (!$input->getArgument('event')) {
    // @todo Expand this list.
    $events = [
      'kernel.controller',
      'kernel.exception',
      'kernel.request',
      'kernel.response',
      'kernel.terminate',
      'kernel.view',
    ];
    $input->setArgument('event', $io->choice((string) $this->t('Enter the event you wish to explore.'), $events));
  }
  if (!$input->getArgument('implementation') && $implementations = $this->getImplementations($input->getArgument('event'))) {
    $choice = $io->choice((string) $this->t('Select the implementation you wish to view.'), array_keys($implementations));
    $input->setArgument('implementation', $choice);
  }
}