protected function buildEnvironmentRows(array $tree, $indent = true, $indicateCurrent = true, $indentAmount = 0)
{
$rows = [];
foreach ($tree as $environment) {
$row = [];
$id = $environment->id;
if ($indent) {
$id = str_repeat(' ', $indentAmount) . $id;
}
if ($indicateCurrent && $this->currentEnvironment && $environment->id == $this->currentEnvironment->id) {
$id .= "<info>*</info>";
}
$row[] = $id;
if ($branch = array_search($environment->id, $this->mapping)) {
$row[] = sprintf('%s (%s)', $environment->title, $branch);
} else {
$row[] = $environment->title;
}
$row[] = $this->formatEnvironmentStatus($environment->status);
$rows[] = $row;
if (isset($this->children[$environment->id])) {
$rows = array_merge($rows, $this->buildEnvironmentRows($this->children[$environment->id], $indent, $indicateCurrent, $indentAmount + 1));
}
}
return $rows;
}