dispatcher = $dispatcher; } protected function configure() { $this->setDefinition([new InputArgument('pattern', InputArgument::OPTIONAL, 'An event pattern to look for')]) ->setDescription('Search for an event'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $options = []; $patterm = $input->getArgument('pattern') ?? 'GNUsocial.*'; $listeners = $this->dispatcher->getListeners(); $listeners = F\select($listeners, function ($_, $key, $__) use ($patterm) { return preg_match('/' . $patterm . '/', $key); }); foreach ($listeners as $event => $listener) { echo 'Event \'' . $event . "\\' handled by:\n"; foreach ($listener as $c) { $r = new \ReflectionFunction($c); echo ' ' . get_class($r->getStaticVariables()['handler'][0]) . "\n"; } } return 0; } }