/** * Create row data for the table depending on the ping result. * * @param Server $server * @return array */ private function getPingRowData($server) { $data = [sprintf("<comment>%s</comment>", $server->getDisplayName()), sprintf("<comment>%s</comment>", $server->getName())]; if ($ping = $server->ping()) { $data[] = $ping; return $data; } $data[] = '<error>Unavailable</error>'; return $data; }
private function showScripts(OutputInterface $output, Project $project, Collection $scripts) { if ($scripts->count() == 0) { $output->writeln('<error>No scripts for this project.</error>'); return 0; } $output->writeln("<comment>Scripts available for " . $project->getName() . "</comment>"); $table = new Table($output); $table->setHeaders(['Script Name', 'Description'])->setRows(collect($scripts)->transform(function (Script $script) use($output) { return ["<info>{$script->name}</info>", ucwords($script->description)]; })->toArray()); $table->render(); $output->writeln(sprintf("<comment>Example use: mersey %s %s <script name></comment>", $this->server->getName(), $project->getName())); return 0; }