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


PHP Table::getStyle方法代码示例

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


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

示例1: renderTable

 /**
  * Writes content to output.
  *
  * @param Table $table
  * @param bool  $decorated
  */
 protected function renderTable(Table $table, $decorated = false)
 {
     if (!$decorated) {
         $table->getStyle()->setCellRowFormat('%s');
         $table->getStyle()->setCellRowContentFormat('%s');
         $table->getStyle()->setCellHeaderFormat('%s');
     }
     $table->render();
 }
开发者ID:CoditoNet,项目名称:silex-console-descriptor,代码行数:15,代码来源:Descriptor.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $composer = $this->getComposer();
     $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
     $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
     $root = $composer->getPackage();
     $repo = $composer->getRepositoryManager()->getLocalRepository();
     if ($input->getOption('no-dev')) {
         $packages = $this->filterRequiredPackages($repo, $root);
     } else {
         $packages = $this->appendPackages($repo->getPackages(), array());
     }
     ksort($packages);
     $io = $this->getIO();
     switch ($format = $input->getOption('format')) {
         case 'text':
             $io->write('Name: <comment>' . $root->getPrettyName() . '</comment>');
             $io->write('Version: <comment>' . $root->getFullPrettyVersion() . '</comment>');
             $io->write('Licenses: <comment>' . (implode(', ', $root->getLicense()) ?: 'none') . '</comment>');
             $io->write('Dependencies:');
             $io->write('');
             $table = new Table($output);
             $table->setStyle('compact');
             $table->getStyle()->setVerticalBorderChar('');
             $table->getStyle()->setCellRowContentFormat('%s  ');
             $table->setHeaders(array('Name', 'Version', 'License'));
             foreach ($packages as $package) {
                 $table->addRow(array($package->getPrettyName(), $package->getFullPrettyVersion(), implode(', ', $package->getLicense()) ?: 'none'));
             }
             $table->render();
             break;
         case 'json':
             $dependencies = array();
             foreach ($packages as $package) {
                 $dependencies[$package->getPrettyName()] = array('version' => $package->getFullPrettyVersion(), 'license' => $package->getLicense());
             }
             $io->write(JsonFile::encode(array('name' => $root->getPrettyName(), 'version' => $root->getFullPrettyVersion(), 'license' => $root->getLicense(), 'dependencies' => $dependencies)));
             break;
         default:
             throw new \RuntimeException(sprintf('Unsupported format "%s".  See help for supported formats.', $format));
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:42,代码来源:LicensesCommand.php

示例3: writeLibraryList

 /**
  * write composer.list
  */
 protected function writeLibraryList($packages)
 {
     $fp = fopen('composer.list', 'wb');
     $output = new \Symfony\Component\Console\Output\StreamOutput($fp);
     $table = new Table($output);
     $table->setStyle('compact');
     $table->getStyle()->setVerticalBorderChar('');
     $table->getStyle()->setCellRowContentFormat('%s  ');
     $table->setHeaders(array('Name', 'Version', 'License'));
     foreach ($packages as $name => $p) {
         $table->addRow(array($name, $p['version'], implode(', ', $p['license']) ?: 'none'));
     }
     $table->render();
     unset($table);
     fclose($fp);
 }
开发者ID:mercari,项目名称:composer-diff-plugin,代码行数:19,代码来源:DiffPlugin.php

示例4: setPadType

 /**
  * Sets cell padding type.
  *
  * @param int $padType STR_PAD_*
  *
  * @return TableHelper
  */
 public function setPadType($padType)
 {
     $this->table->getStyle()->setPadType($padType);
     return $this;
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:12,代码来源:TableHelper.php

示例5: describeEventDispatcherListeners

 /**
  * {@inheritdoc}
  */
 protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = array())
 {
     $event = array_key_exists('event', $options) ? $options['event'] : null;
     $label = 'Registered listeners';
     if (null !== $event) {
         $label .= sprintf(' for event <info>%s</info>', $event);
     } else {
         $label .= ' by event';
     }
     $this->writeText($this->formatSection('event_dispatcher', $label) . "\n", $options);
     $registeredListeners = $eventDispatcher->getListeners($event);
     if (null !== $event) {
         $this->writeText("\n");
         $table = new Table($this->getOutput());
         $table->getStyle()->setCellHeaderFormat('%s');
         $table->setHeaders(array('Order', 'Callable'));
         foreach ($registeredListeners as $order => $listener) {
             $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener)));
         }
         $this->renderTable($table, true);
     } else {
         ksort($registeredListeners);
         foreach ($registeredListeners as $eventListened => $eventListeners) {
             $this->writeText(sprintf("\n<info>[Event]</info> %s\n", $eventListened), $options);
             $table = new Table($this->getOutput());
             $table->getStyle()->setCellHeaderFormat('%s');
             $table->setHeaders(array('Order', 'Callable'));
             foreach ($eventListeners as $order => $eventListener) {
                 $table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener)));
             }
             $this->renderTable($table, true);
         }
     }
 }
开发者ID:Chaireeee,项目名称:chaireeee,代码行数:37,代码来源:TextDescriptor.php

示例6: renderTable

 /**
  * Render a Console Table view from listeners collection
  *
  * @param OutputInterface $output
  * @param array<EventListener> $eventListeners a collection of event listeners
  *
  * @return void intented to render a Table
  */
 private function renderTable(OutputInterface $output, array $eventListeners)
 {
     $table = new Table($output);
     $table->getStyle()->setCellHeaderFormat('%s');
     $table->setHeaders(array('Order', 'Callable'));
     $order = 1;
     foreach ($eventListeners as $eventListened) {
         $table->addRow(array(sprintf('# %d', $order++), $this->formatCallable($eventListened)));
     }
     $table->render();
 }
开发者ID:backbee,项目名称:debug-bundle,代码行数:19,代码来源:DebugEventDispatcherCommand.php

示例7: printTable

 /**
  * Assembles and prints a bottom-up table of the dependencies.
  *
  * @param OutputInterface $output
  * @param array           $results
  */
 protected function printTable(OutputInterface $output, $results)
 {
     $table = array();
     $doubles = array();
     do {
         $queue = array();
         $rows = array();
         foreach ($results as $result) {
             /**
              * @var PackageInterface $package
              * @var Link             $link
              */
             list($package, $link, $children) = $result;
             $unique = (string) $link;
             if (isset($doubles[$unique])) {
                 continue;
             }
             $doubles[$unique] = true;
             $version = strpos($package->getPrettyVersion(), 'No version set') === 0 ? '-' : $package->getPrettyVersion();
             $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
             if ($children) {
                 $queue = array_merge($queue, $children);
             }
         }
         $results = $queue;
         $table = array_merge($rows, $table);
     } while (!empty($results));
     // Render table
     $renderer = new Table($output);
     $renderer->setStyle('compact');
     $renderer->getStyle()->setVerticalBorderChar('');
     $renderer->getStyle()->setCellRowContentFormat('%s  ');
     $renderer->setRows($table)->render();
 }
开发者ID:neon64,项目名称:composer,代码行数:40,代码来源:BaseDependencyCommand.php

示例8: renderEventListenerTable

 /**
  * @param array $array
  */
 private function renderEventListenerTable(array $eventListeners)
 {
     $table = new Table($this->getOutput());
     $table->getStyle()->setCellHeaderFormat('%s');
     $table->setHeaders(array('Order', 'Callable', 'Priority'));
     krsort($eventListeners);
     $order = 1;
     foreach ($eventListeners as $priority => $listeners) {
         foreach ($listeners as $listener) {
             $table->addRow(array(sprintf('#%d', $order++), $this->formatCallable($listener), $priority));
         }
     }
     $table->render();
 }
开发者ID:romankd,项目名称:symfony,代码行数:17,代码来源:TextDescriptor.php

示例9: outputPaths

 /**
  * Render the modman paths in a nice format
  *
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @param array $paths
  * @param string $prefix
  */
 protected function outputPaths(OutputInterface $output, $paths, $prefix = '')
 {
     // Make sure the prefix ends with 1 slash
     $prefix = $prefix ? rtrim($prefix, '/') . '/' : '';
     $rows = array();
     foreach ($paths as $path) {
         // Add dir prefix + space suffix
         $rows[] = array($prefix . $path . ' ', $path);
     }
     // Write output in nice format
     $table = new Table($output);
     $table->setRows($rows);
     // Set spaceless
     $table->setStyle('compact');
     $table->getStyle()->setBorderFormat('');
     // Output to screen
     $table->render();
 }
开发者ID:DavidLambauer,项目名称:magerun-modman,代码行数:25,代码来源:GenerateCommand.php

示例10: detailsTable

 public function detailsTable(array $rows)
 {
     $rows = array_map(function ($row) {
         $row[0] = sprintf('<info>%s:</>', $row[0]);
         return $row;
     }, $rows);
     $table = new Table($this->output);
     $table->getStyle()->setPaddingChar(' ')->setHorizontalBorderChar('')->setVerticalBorderChar(' ')->setCrossingChar('')->setCellHeaderFormat('%s')->setCellRowFormat('%s')->setCellRowContentFormat('%s')->setBorderFormat('%s')->setPadType(STR_PAD_RIGHT);
     $table->setRows($rows);
     $table->render();
     $this->newLine();
 }
开发者ID:gushphp,项目名称:gush,代码行数:12,代码来源:StyleHelper.php

示例11: detailsTable

 private function detailsTable(array $rows, $bordered = false)
 {
     if (!$rows) {
         return '';
     }
     $rows = array_map(function ($row) {
         $row[0] = sprintf('<info>%s:</info>', $row[0]);
         return $row;
     }, $rows);
     $table = new Table($this->bufferedOut);
     $table->getStyle()->setPaddingChar(' ')->setHorizontalBorderChar($bordered ? '-' : '')->setVerticalBorderChar(' ')->setCrossingChar('-')->setCellHeaderFormat('%s')->setCellRowFormat('%s')->setCellRowContentFormat('%s')->setBorderFormat('%s')->setPadType(STR_PAD_RIGHT);
     $table->setRows($rows);
     $table->render();
     return $this->bufferedOut->fetch();
 }
开发者ID:rollerworks,项目名称:SkeletonDancer,代码行数:15,代码来源:ProfileCommandHandler.php


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