Kraken\Console\Client\Command\Project\ProjectStatusCommand::buildTable PHP Method

buildTable() private method

private buildTable ( mixed $current, string $prefix = '', boolean $isLast = false ) : mixed
$current mixed
$prefix string
$isLast boolean
return mixed
    private function buildTable($current, $prefix = '', $isLast = false)
    {
        $data = [];
        $currentPrefix = $prefix === '' ? '' : substr($prefix, 0, -2) . ($isLast ? '└-' : '├-');
        $data[] = ['alias' => $currentPrefix . $current['alias'], 'name' => $current['name'], 'state' => $this->parseState($current['state'])];
        $count = count($current['children']);
        for ($i = 0; $i < $count; ++$i) {
            $child = $current['children'][$i];
            if ($i === $count - 1) {
                $data = array_merge($data, $this->buildTable($child, $prefix . '  ', true));
            } else {
                $data = array_merge($data, $this->buildTable($child, $prefix . '| '));
            }
        }
        return $data;
    }