From 330177064273330c06b48aadabc4c7ca8bb70932 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Fri, 6 Nov 2020 19:48:40 +0000 Subject: [PATCH] [COMMAND] Change the way ListEventsCommand outputs the results to use the output interface and add some formatting --- src/Command/ListEventsCommand.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Command/ListEventsCommand.php b/src/Command/ListEventsCommand.php index f2e6e149b5..590b591fa0 100644 --- a/src/Command/ListEventsCommand.php +++ b/src/Command/ListEventsCommand.php @@ -67,6 +67,9 @@ EOF ); } + /** + * Execute the command, outputing a list of GNU social events + */ protected function execute(InputInterface $input, OutputInterface $output): int { $patterm = $input->getArgument('pattern') ?? 'GNUsocial.*'; @@ -76,15 +79,16 @@ EOF return preg_match('/' . $patterm . '/', $key); }); - echo "\n"; + ksort($listeners); foreach ($listeners as $event => $listener) { - echo "Event '{$event}':\n"; + $event = explode('.', $event)[1]; + $output->writeln("Event '{$event}':"); foreach ($listener as $c) { $r = new ReflectionFunction($c); $m = $r->getStaticVariables()['handler']; - echo ' ' . get_class($m[0]) . '::' . $m[1] . "\n"; + $output->writeln("\t" . get_class($m[0]) . '::' . $m[1]); } - echo "\n"; + $output->writeln(''); } if (!$input->hasArgument('pattern')) {