X-Git-Url: https://git.cweiske.de/bdrem.git/blobdiff_plain/62842c0ba16bb1dc67435dea7b4d75af7773eacb..6032c11d7a88651d85154ffe835a26b3f569c893:/src/bdrem/Renderer/Console.php diff --git a/src/bdrem/Renderer/Console.php b/src/bdrem/Renderer/Console.php index 87eeb9a..61fb67e 100644 --- a/src/bdrem/Renderer/Console.php +++ b/src/bdrem/Renderer/Console.php @@ -1,8 +1,35 @@ + * @copyright 2014 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @link http://cweiske.de/bdrem.htm + */ namespace bdrem; +/** + * Render events on the terminal as ASCII table + * + * @category Tools + * @package Bdrem + * @author Christian Weiske + * @copyright 2014 Christian Weiske + * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 + * @version Release: @package_version@ + * @link http://cweiske.de/bdrem.htm + */ class Renderer_Console extends Renderer { + /** + * HTTP content type + * @var string + */ protected $httpContentType = 'text/plain; charset=utf-8'; /** @@ -17,6 +44,13 @@ class Renderer_Console extends Renderer */ protected $cc; + /** + * Render events as console table + * + * @param array $arEvents Array of events to render + * + * @return string ASCII table + */ public function render($arEvents) { $this->loadConfig(); @@ -70,6 +104,14 @@ class Renderer_Console extends Renderer return $tbl->getTable(); } + /** + * Wrap each string in an array in an ANSI color code + * + * @param array $data Array of strings + * @param string $colorCode ANSI color code or name + * + * @return array Wrapped data + */ protected function ansiWrap($data, $colorCode = null) { if (!$this->ansi || $colorCode === null) { @@ -84,6 +126,11 @@ class Renderer_Console extends Renderer return $data; } + /** + * Load configuration values into the class + * + * @return void + */ protected function loadConfig() { if (isset($this->config->ansi)) {