addOption( 'json', null, InputOption::VALUE_NONE, 'Output namespaces as JSON', ); } protected function execute(InputInterface $input, OutputInterface $output): int { $globalNamespaces = $this->viewHelperResolverFactory->create()->getNamespaces(); if ($input->getOption('json')) { $output->writeln(json_encode($globalNamespaces)); return Command::SUCCESS; } $table = new Table($output); $table->setHeaders(['Alias', 'Namespace(s)']); $isFirst = true; foreach ($globalNamespaces as $alias => $namespaceChain) { if (!$isFirst) { $table->addRow(new TableSeparator()); } $table->addRow([ $alias, new TableCell(implode("\n", $namespaceChain), ['rowspan' => count($namespaceChain)]), ]); $isFirst = false; } $table->render(); return Command::SUCCESS; } }