protected function execute(InputInterface $input, OutputInterface $output) { try { $sku = $input->getArgument('sku'); $result = $this->productStatusAdapter->getStatusForProductsMatchingSku($sku); if (empty($result)) { $output->writeln(sprintf('<comment>No products matching "%s" found</comment>', $sku)); } else { array_map(function ($sku, $status) use($output) { $output->writeln(sprintf('<info>Status of product "%s": %s</info>', $sku, $status)); }, array_keys($result), $result); } } catch (\Exception $exception) { $output->writeln('<error>' . $exception->getMessage() . '</error>'); } }