[COMMAND] Change the way ListEventsCommand outputs the results to use the output interface and add some formatting
This commit is contained in:
parent
e8feb2ae84
commit
3301770642
@ -67,6 +67,9 @@ EOF
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the command, outputing a list of GNU social events
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$patterm = $input->getArgument('pattern') ?? 'GNUsocial.*';
|
$patterm = $input->getArgument('pattern') ?? 'GNUsocial.*';
|
||||||
@ -76,15 +79,16 @@ EOF
|
|||||||
return preg_match('/' . $patterm . '/', $key);
|
return preg_match('/' . $patterm . '/', $key);
|
||||||
});
|
});
|
||||||
|
|
||||||
echo "\n";
|
ksort($listeners);
|
||||||
foreach ($listeners as $event => $listener) {
|
foreach ($listeners as $event => $listener) {
|
||||||
echo "Event '{$event}':\n";
|
$event = explode('.', $event)[1];
|
||||||
|
$output->writeln("<info>Event '<options=bold>{$event}</options=bold>':</info>");
|
||||||
foreach ($listener as $c) {
|
foreach ($listener as $c) {
|
||||||
$r = new ReflectionFunction($c);
|
$r = new ReflectionFunction($c);
|
||||||
$m = $r->getStaticVariables()['handler'];
|
$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')) {
|
if (!$input->hasArgument('pattern')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user