Example #1
0
 public function __construct($terminal, $title, $data, Borderset $borderset)
 {
     parent::__construct($terminal, $borderset);
     $this->selectedKey = null;
     $this->title = $title;
     $this->data = $data;
 }
Example #2
0
 public function __construct($terminal, $title, $contents, array $options, Borderset $borderset)
 {
     parent::__construct($terminal, $borderset);
     $this->title = $title;
     $this->contents = $contents;
     $o = [];
     foreach ($options as $i => $option) {
         $o[] = [$i, $option];
     }
     $this->options = $o;
     $this->textAlign = self::TEXT_ALIGN_CENTER;
 }
Example #3
0
 public function __construct($terminal, $title, $data, $headers, Borderset $borderset)
 {
     parent::__construct($terminal, $borderset);
     $this->title = $title;
     $this->data = $data;
     $this->headers = $headers;
     $this->index = 0;
     $templates = [];
     foreach ($headers as $key => $header) {
         $this->rowLengths[$key] = max(strlen($header), call_user_func_array('max', array_map(function ($row) use($key) {
             return strlen($row[$key]);
         }, $data)));
         $templates[] = "%-" . $this->rowLengths[$key] . "s";
     }
     $this->rowTemplate = " " . implode(" │ ", $templates) . " ";
 }