PhpSchool\CliMenu\Frame::addRows PHP Method

addRows() public method

public addRows ( array $rows = [] )
$rows array
    public function addRows(array $rows = [])
    {
        foreach ($rows as $row) {
            $this->rows[] = $row;
        }
    }

Usage Example

Example #1
0
 /**
  * Draw the menu to STDOUT
  */
 protected function draw()
 {
     $this->terminal->clean();
     $this->terminal->moveCursorToTop();
     $frame = new Frame();
     $frame->newLine(2);
     if (is_string($this->title)) {
         $frame->addRows($this->drawMenuItem(new LineBreakItem()));
         $frame->addRows($this->drawMenuItem(new StaticItem($this->title)));
         $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator())));
     }
     array_map(function ($item, $index) use($frame) {
         $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem));
     }, $this->items, array_keys($this->items));
     $frame->addRows($this->drawMenuItem(new LineBreakItem()));
     $frame->newLine(2);
     foreach ($frame->getRows() as $row) {
         echo $row;
     }
     $this->currentFrame = $frame;
 }