public function _renderCLI($array_key = NULL) { $label = $this->type . '(' . $this->resource_type . ')'; $result = $this->renderArrayKey($array_key) . CLIColors::getColoredString($label, 'yellow') . "\n"; if (!empty($this->resource_custom_data)) { if (is_array($this->resource_custom_data)) { foreach ($this->resource_custom_data as $k => $v) { if (is_array($v)) { $result .= $this->indentCLI() . $k . "\n"; foreach ($v as $sub_k => $sub_v) { $stripped = strip_tags($sub_v); if (strlen($stripped) > 0) { $result .= $this->indentCLI(1) . $sub_k . ': ' . $stripped . "\n"; } } } else { $result .= $this->indentCLI() . $k . ': ' . strip_tags($v) . "\n"; } } } else { $result .= $this->indentCLI() . $this->resource_custom_data . "\n"; } } return $result; }
protected function _renderCLI($array_key = null) { $label = $this->type . '(' . $this->length . ')'; $result = ''; if (!is_null($array_key)) { $result .= '[' . $array_key . ']: '; } $result .= CLIColors::getColoredString($label, 'yellow') . "\n"; foreach ($this->value as $k => $v) { $result .= $this->indentCLI() . $v->render($k, 'cli'); } return $result; }
private function _renderListCLI(&$list, $title) { $result = ''; if (!empty($list)) { $result .= $this->indentCLI() . CLIColors::getColoredString($title, NULL, 'magenta') . "\n"; foreach ($list as $k => $v) { $result .= $this->indentCLI(); if (is_string($v)) { $result .= $v; } else { $result .= $v->render($k, 'cli'); } $result .= "\n"; } } // remove extra "\n" $result = preg_replace('/\\n+/', "\n", $result); return $result; }
protected function indentCLI($increment = 0) { $char1 = CLIColors::getColoredString(' ', 'dark_gray'); $char2 = CLIColors::getColoredString(' | ', 'dark_gray'); $result = ''; for ($i = 0; $i < $this->level + $increment; $i++) { if ($i == 0) { $result .= $char1; } else { $result .= $char2; } } return $result; }
protected function _renderCLI($array_key = null) { return $this->renderArrayKey($array_key) . $this->type . '(' . $this->length . ') ' . CLIColors::getColoredString($this->getValue(), $this->getColor('cli')) . "\n"; }