function ServerDumpCommand::execute
Overrides Command::execute
File
-
vendor/
symfony/ var-dumper/ Command/ ServerDumpCommand.php, line 76
Class
- ServerDumpCommand
- Starts a dump server to collect and output dumps on a single place with multiple formats support.
Namespace
Symfony\Component\VarDumper\CommandCode
protected function execute(InputInterface $input, OutputInterface $output) : int {
$io = new SymfonyStyle($input, $output);
$format = $input->getOption('format');
if (!($descriptor = $this->descriptors[$format] ?? null)) {
throw new InvalidArgumentException(\sprintf('Unsupported format "%s".', $format));
}
$errorIo = $io->getErrorStyle();
$errorIo->title('Symfony Var Dumper Server');
$this->server
->start();
$errorIo->success(\sprintf('Server listening on %s', $this->server
->getHost()));
$errorIo->comment('Quit the server with CONTROL-C.');
$this->server
->listen(function (Data $data, array $context, int $clientId) use ($descriptor, $io) {
$descriptor->describe($io, $data, $context, $clientId);
});
return 0;
}