/** * Execute this command. * * @return int|void */ protected function doExecute() { $tableModel = new Table(); $statuses = $tableModel->status(); $tables = ArrayHelper::getColumn($statuses, 'table'); $maxLength = max(array_map('strlen', $tables)); // Show message $this->out()->out('Track Status:')->out(); $titleSpaces = $maxLength - 5; $this->out(sprintf("TABLE NAME %-{$titleSpaces}s STATUS", '')); $this->out('---------------------------------------------------------------'); // List table & status foreach ($statuses as $status) { $spaces = $maxLength - strlen($status['table']) + 4; $this->out(sprintf("- %s %-{$spaces}s %s", $status['table'], '', $status['status'])); } }