当前位置: 首页>>代码示例>>PHP>>正文


PHP TableStyle::setHorizontalBorderChar方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Helper\TableStyle::setHorizontalBorderChar方法的典型用法代码示例。如果您正苦于以下问题:PHP TableStyle::setHorizontalBorderChar方法的具体用法?PHP TableStyle::setHorizontalBorderChar怎么用?PHP TableStyle::setHorizontalBorderChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Helper\TableStyle的用法示例。


在下文中一共展示了TableStyle::setHorizontalBorderChar方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write

 /**
  *
  * {@inheritDoc}
  *
  * @see \SK\ITCBundle\Service\Table\Adapter\IAdapter::write()
  */
 public function write(Table $table, OutputInterface $output)
 {
     $style = new TableStyle();
     $style->setHorizontalBorderChar('<fg=magenta>-</>')->setVerticalBorderChar('<fg=magenta>|</>')->setCrossingChar('<fg=magenta>+</>');
     $stable = new STable($output);
     $stable->setStyle('default');
     $stable->setHeaders($table->getHeaders());
     $columns = $table->getColumns();
     $colspan = count($columns);
     $rows = $table->getRows();
     foreach ($rows as $row) {
         $rowModificated = [];
         foreach ($columns as $iCol => $col) {
             if (is_int($iCol)) {
                 $iCol = $col;
             }
             if (array_key_exists($iCol, $row)) {
                 $rowModificated[$iCol] = wordwrap($row[$iCol], $table->getMaxColWidth(), "\n", true);
             } else {
                 $rowModificated[$iCol] = "";
             }
         }
         $stable->addRow($rowModificated);
         $stable->addRow(array(new TableSeparator(array('colspan' => $colspan))));
     }
     $stable->addRow(array(new TableCell("", array('colspan' => $colspan))));
     $stable->addRow(array(new TableCell(sprintf("Found %s results.", count($rows)), array('colspan' => $colspan))));
     $stable->render();
 }
开发者ID:slavomirkuzma,项目名称:itc-bundle,代码行数:35,代码来源:TXT.php

示例2: initStyles

 private static function initStyles()
 {
     $borderless = new TableStyle();
     $borderless->setHorizontalBorderChar('=')->setVerticalBorderChar(' ')->setCrossingChar(' ');
     $compact = new TableStyle();
     $compact->setHorizontalBorderChar('')->setVerticalBorderChar(' ')->setCrossingChar('')->setCellRowContentFormat('%s');
     return array('default' => new TableStyle(), 'borderless' => $borderless, 'compact' => $compact);
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:8,代码来源:Table.php

示例3: displayErrors

 /**
  * Display validation errors.
  *
  * @param Validator       $validator The json-schema validator.
  * @param OutputInterface $output    An OutputInterface instance.
  */
 public static function displayErrors(Validator $validator, OutputInterface $output)
 {
     $table = new Table($output);
     $style = new TableStyle();
     $style->setCellHeaderFormat('<error>%s</error>');
     $style->setHorizontalBorderChar(' ');
     $style->setVerticalBorderChar(' ');
     $style->setCrossingChar(' ');
     $table->setHeaders(['Property', 'Error']);
     $table->setRows($validator->getErrors());
     $table->setStyle($style);
     $table->render();
 }
开发者ID:emanueleminotto,项目名称:schemer,代码行数:19,代码来源:Utils.php

示例4: table

 /**
  * {@inheritdoc}
  */
 public function table(array $headers, array $rows)
 {
     $headers = array_map(function ($value) {
         return sprintf("<info>%s</info>", $value);
     }, $headers);
     $styleGuide = new TableStyle();
     $styleGuide->setHorizontalBorderChar('-')->setVerticalBorderChar('|')->setCrossingChar('+')->setCellHeaderFormat('%s');
     $table = new Table($this);
     $table->setHeaders($headers);
     $table->setRows($rows);
     $table->setStyle($styleGuide);
     $table->render();
     $this->newLine();
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:17,代码来源:SystemInfoStyle.php

示例5: displayTableResults

 public function displayTableResults(OutputInterface $output, $object, array $keysOnly = [], $maxWidth = 35, $count = false)
 {
     $table = new Table($output);
     $style = new TableStyle();
     $style->setHorizontalBorderChar('<fg=magenta>-</>')->setVerticalBorderChar('<fg=magenta>|</>')->setCrossingChar(' ');
     $table->setStyle($style);
     if ($object instanceof CollectionAbstract) {
         $list = $object->toArray();
     } else {
         $list = $object;
     }
     $i = 0;
     foreach ($list as $item) {
         if (!is_array($item)) {
             continue;
         }
         ++$i;
         foreach ($item as $key => $value) {
             if (!empty($keysOnly) && !in_array($key, $keysOnly, true)) {
                 unset($item[$key]);
                 continue;
             }
             if (is_array($value)) {
                 $value = json_encode($value);
             }
             if (is_float($value)) {
                 $value = number_format($value, 3);
             }
             $value = str_replace(['["', '"]', '{"', '"', '}'], [], $value);
             if (empty($value)) {
                 $value = '~';
             }
             $value = substr($value, 0, $maxWidth);
             $item[$key] = $value;
         }
         if (true === $count) {
             $item = array_merge(['#' => $i], $item);
         }
         if (!isset($headers)) {
             $headers = array_keys($item);
             $table->setHeaders($headers);
         }
         $table->addRow($item);
     }
     return $table->render($output);
 }
开发者ID:gpupo,项目名称:common,代码行数:46,代码来源:TableTrait.php

示例6: testStyle

    public function testStyle()
    {
        $style = new TableStyle();
        $style->setHorizontalBorderChar('.')->setVerticalBorderChar('.')->setCrossingChar('.');
        Table::setStyleDefinition('dotfull', $style);
        $table = new Table($output = $this->getOutputStream());
        $table->setHeaders(array('Foo'))->setRows(array(array('Bar')))->setStyle('dotfull');
        $table->render();
        $expected = <<<TABLE
.......
. Foo .
.......
. Bar .
.......

TABLE;
        $this->assertEquals($expected, $this->getOutputContent($output));
    }
开发者ID:sintoris,项目名称:Known,代码行数:18,代码来源:TableTest.php

示例7: addCustomTableStyles

 /**
  * Add our custom table style(s) to the table.
  */
 protected static function addCustomTableStyles($table)
 {
     // The 'consolidation' style is the same as the 'symfony-style-guide'
     // style, except it maintains the colored headers used in 'default'.
     $consolidationStyle = new TableStyle();
     $consolidationStyle->setHorizontalBorderChar('-')->setVerticalBorderChar(' ')->setCrossingChar(' ');
     $table->setStyleDefinition('consolidation', $consolidationStyle);
 }
开发者ID:consolidation,项目名称:output-formatters,代码行数:11,代码来源:TableFormatter.php

示例8: table

 /**
  * @param string[] $rows
  * @param string[] $headers
  */
 public function table(array $rows, array $headers = null)
 {
     $rows = array_map(function ($value) {
         if (!is_array($value)) {
             return $value;
         }
         $header = array_shift($value);
         array_unshift($value, sprintf('<fg=blue>%s</>', $header));
         return $value;
     }, $rows);
     $style = new TableStyle();
     $style->setVerticalBorderChar('<fg=blue>|</>');
     $style->setHorizontalBorderChar('<fg=blue>-</>');
     $style->setCrossingChar('<fg=blue>+</>');
     $style->setCellHeaderFormat('%s');
     $table = new Table($this);
     $table->setStyle($style);
     if ($headers) {
         $table->setHeaders($headers);
     }
     $table->setRows($rows);
     $table->render();
     $this->newLine();
 }
开发者ID:src-run,项目名称:vermicious-console-io-library,代码行数:28,代码来源:Style.php


注:本文中的Symfony\Component\Console\Helper\TableStyle::setHorizontalBorderChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。