src/Run/Commands/ConfigTrait.php
private function renderConfigRows($rows, $cardinality = 0) {
        if ($cardinality > 0) {
            $prefix = str_repeat('  ', $cardinality - 1) . '↳ ';
        } else {
            $prefix = '';
        }
        $rowsNew = [];
        foreach ($rows as $key => $value) {
            $keyStr = !is_numeric($key) ? $prefix . $key : $prefix . $key;
            $valueArray = null;
            if (is_array($value)) {
                $isSimpleArray = false;
                if (ArrayHelper::isIndexed($value)) {
                    $isSimpleArray = true;
                    foreach ($value as $valueChild) {
                        if (!is_scalar($valueChild)) {
                            $isSimpleArray = false;
                            break;
                        }
                    }
                }
                if ($isSimpleArray) {
                    foreach ($value as &$valueChild) {
                        $valueChild = $this->renderValue($valueChild);
                    }
                    $valueStr = '[' . implode(', ', $value) . ']';
                } else {
                    $valueStr = '↓ []';
                    $valueArray = $this->renderConfigRows($value, $cardinality + 1);
                }
            } else {
                $valueStr = $this->renderValue($value);
            }
            $valueStr = '<comment>' . $valueStr . '</comment>';
            $rowsNew[] = [$keyStr, $valueStr];
            if (isset($valueArray)) {
                $rowsNew = ArrayHelper::merge($rowsNew, $valueArray);
            }
        }
        return $rowsNew;
    }
private function renderConfigRows($rows, $cardinality = 0) {
        if ($cardinality > 0) {
            $prefix = str_repeat('  ', $cardinality - 1) . '↳ ';
        } else {
            $prefix = '';
        }
        $rowsNew = [];
        foreach ($rows as $key => $value) {
            $keyStr = !is_numeric($key) ? $prefix . $key : $prefix . $key;
            $valueArray = null;
            if (is_array($value)) {
                $isSimpleArray = false;
                if (ArrayHelper::isIndexed($value)) {
                    $isSimpleArray = true;
                    foreach ($value as $valueChild) {
                        if (!is_scalar($valueChild)) {
                            $isSimpleArray = false;
                            break;
                        }
                    }
                }
                if ($isSimpleArray) {
                    foreach ($value as &$valueChild) {
                        $valueChild = $this->renderValue($valueChild);
                    }
                    $valueStr = '[' . implode(', ', $value) . ']';
                } else {
                    $valueStr = '↓ []';
                    $valueArray = $this->renderConfigRows($value, $cardinality + 1);
                }
            } else {
                $valueStr = $this->renderValue($value);
            }
            $valueStr = '<comment>' . $valueStr . '</comment>';
            $rowsNew[] = [$keyStr, $valueStr];
            if (isset($valueArray)) {
                $rowsNew = ArrayHelper::merge($rowsNew, $valueArray);
            }
        }
        return $rowsNew;
    }
Normalize config rows for render in table
@param array $rows
@param int   $cardinality
@return array