Webmozart\Console\UI\Component\Grid::render PHP Метод

render() публичный Метод

Renders the grid.
public render ( IO $io, integer $indentation )
$io Webmozart\Console\Api\IO\IO The I/O.
$indentation integer The number of spaces to indent.
    public function render(IO $io, $indentation = 0)
    {
        // Is the grid empty?
        if (!$this->cells) {
            return;
        }
        $screenWidth = $io->getTerminalDimensions()->getWidth();
        $excessColumnWidth = StringUtil::getLength(sprintf($this->style->getCellFormat(), ''), $io);
        $wrapper = $this->getCellWrapper($io, $screenWidth, $excessColumnWidth, $indentation);
        $this->renderRows($io, $wrapper->getWrappedRows(), $wrapper->getColumnLengths(), $excessColumnWidth, $indentation);
    }

Usage Example

Пример #1
0
 /**
  * Prints the resources in the short style (without the "-l" option).
  *
  * @param IO                 $io        The I/O.
  * @param ResourceCollection $resources The resources.
  */
 private function listShort(IO $io, ResourceCollection $resources)
 {
     $style = GridStyle::borderless();
     $style->getBorderStyle()->setLineVCChar('  ');
     $grid = new Grid($style);
     foreach ($resources as $resource) {
         $grid->addCell($this->formatName($resource));
     }
     $grid->render($io);
 }
All Usage Examples Of Webmozart\Console\UI\Component\Grid::render