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


PHP Table::addRows方法代码示例

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


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

示例1: write

 public function write(Table $table, UuidInterface $uuid)
 {
     $table->addRows(array(array('encode:', 'STR:', (string) $uuid), array('', 'INT:', (string) $uuid->getInteger())));
     if ($uuid->getVariant() == Uuid::RFC_4122) {
         $table->addRows(array(array('decode:', 'variant:', $this->getFormattedVariant($uuid)), array('', 'version:', $this->getFormattedVersion($uuid))));
         $table->addRows($this->getContent($uuid));
     } else {
         $table->addRows(array(array('decode:', 'variant:', 'Not an RFC 4122 UUID')));
     }
 }
开发者ID:ramsey,项目名称:uuid-console,代码行数:10,代码来源:UuidFormatter.php

示例2: showDown

 private function showDown(PokerGame $pokerGame)
 {
     $pokerGame->scoreHand();
     $table = new Table($this->output);
     foreach ($pokerGame->pokerPlayers as $player) {
         $finalHand = $player->showBestHand();
         $table->addRows([$finalHand]);
     }
     $finalHand = $pokerGame->hero->showBestHand();
     $table->addRows([$finalHand]);
     $table->render($this->output);
 }
开发者ID:HinchK,项目名称:CantinaPoker,代码行数:12,代码来源:DealPokerCommand.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->validateInput($input);
     $environment = $this->getSelectedEnvironment();
     $limit = (int) $input->getOption('limit');
     $activities = $environment->getActivities($limit, $input->getOption('type'));
     if (!$activities) {
         $this->stdErr->writeln('No activities found');
         return 1;
     }
     $headers = array("ID", "Created", "Description", "% Complete", "Result");
     $rows = array();
     foreach ($activities as $activity) {
         $description = $activity->getDescription();
         $description = wordwrap($description, 40);
         $rows[] = array($activity['id'], date('Y-m-d H:i:s', strtotime($activity['created_at'])), $description, $activity->getCompletionPercent(), $activity->state);
     }
     if ($output instanceof StreamOutput && ($input->getOption('pipe') || !$this->isTerminal($output))) {
         $stream = $output->getStream();
         array_unshift($rows, $headers);
         foreach ($rows as $row) {
             fputcsv($stream, $row, "\t");
         }
         return 0;
     }
     $this->stdErr->writeln("Recent activities for the environment <info>" . $environment['id'] . "</info>");
     $table = new Table($output);
     $table->setHeaders($headers);
     $table->addRows($rows);
     $table->render();
     return 0;
 }
开发者ID:joshmiller83,项目名称:platformsh-cli,代码行数:32,代码来源:ActivityListCommand.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $projectName = $input->getOption('project_name');
     $serviceName = $input->getOption('service_name');
     $em = $this->get('entity_manager');
     /*
      * Get Entities
      */
     $projectRepository = $em->getRepository('Mindgruve\\Gruver\\Entity\\Project');
     $serviceRepository = $em->getRepository('Mindgruve\\Gruver\\Entity\\Service');
     $releaseRepository = $em->getRepository('Mindgruve\\Gruver\\Entity\\Release');
     $project = $projectRepository->loadProjectByName($projectName);
     if (!$project) {
         $output->writeln('<error>Project ' . $projectName . ' does not exist </error>');
         return;
     }
     /**
      * Check if Configuration needs to be reloaded
      */
     $this->checkConfigHash($project, $input, $output);
     $service = $serviceRepository->loadServiceByName($project, $serviceName);
     /*
      * Check if Service Exists
      */
     if (!$service) {
         $output->writeln('<error>Service ' . $serviceName . ' does not exist </error>');
         return;
     }
     $output->writeln('');
     /*
      * Current Release
      */
     $currentRelease = $service->getCurrentRelease();
     $pendingRelease = $service->getPendingRelease();
     $rollbackRelease = $service->getRollbackRelease();
     $releases = $releaseRepository->findAll($project, $service);
     $rows = array();
     foreach ($releases as $release) {
         $status = '';
         $tag = $release->getTag();
         if ($pendingRelease && $release->getId() == $pendingRelease->getId()) {
             $status = '<comment>pending</comment>';
         }
         if ($currentRelease && $release->getId() == $currentRelease->getId()) {
             $status = '<info>current</info>';
         }
         if ($rollbackRelease && $release->getId() == $rollbackRelease->getId()) {
             $status = 'rollback';
         }
         $date = 'n/a';
         if ($release->getCreatedAt()) {
             $date = DateTimeHelper::humanTimeDiff($release->getCreatedAt()->getTimestamp());
         }
         $rows[] = array($tag . ' ' . $status, $date, $release->getContainerID(), $release->getContainerIp(), $release->getContainerPort(), $release->getId(), $release->getUuid());
     }
     $table = new Table($output);
     $table->setHeaders(array('Tag', 'Run Date', 'Container', 'IP', 'Port', 'ID', 'UUID'));
     $table->addRows($rows);
     $table->render();
 }
开发者ID:mindgruve,项目名称:gruver,代码行数:60,代码来源:StatusCommand.php

示例5: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $app = $this->getSilexApplication();
     $entity = str_replace('.', '\\', $input->getArgument('entity'));
     /** @var EntityManagerInterface $em */
     $em = $app['orm.em'];
     $qb = $em->createQueryBuilder()->from($entity, 'main');
     if ($input->getOption('columns')) {
         $qb->select($input->getOption('columns'));
     } else {
         $qb->select('main');
     }
     if ($input->getOption('limit')) {
         $qb->setMaxResults($input->getOption('limit'));
         if ($input->getOption('start') !== null) {
             $qb->setFirstResult($input->getOption('start'));
         }
     }
     if ($input->getOption('filter')) {
         $qb->where($input->getOption('filter'));
     }
     $query = $qb->getQuery();
     $results = $query->getResult('simple');
     if (empty($results)) {
         $output->writeln('<info>No Results</info>');
         return;
     }
     $table = new Table($output);
     $table->setHeaders(array_keys($results[0]));
     $table->addRows($results);
     $table->render();
 }
开发者ID:apitude,项目名称:apitude,代码行数:32,代码来源:ListCommand.php

示例6: render

 /**
  * @param OutputInterface $output
  * @param array           $actions
  * @param bool            $empty
  */
 protected function render(OutputInterface $output, array $actions, $empty = false)
 {
     $fields = ['action' => 'name', 'workers' => 'current-watching', 'reserved' => 'current-jobs-reserved', 'ready' => 'current-jobs-ready', 'urgent' => 'current-jobs-urgent', 'delayed' => 'current-jobs-delayed', 'buried' => 'current-jobs-buried'];
     $table = new Table($output);
     $table->setHeaders(array_keys($fields));
     $rows = [];
     foreach ($actions as $action) {
         if (!($stats = $this->manager->getActionStats($action))) {
             if (!$empty) {
                 continue;
             }
             $stats = array_combine(array_values($fields), array_fill(0, sizeof($fields), '-'));
             $stats['name'] = $action;
         }
         $rows[$action] = array_map(function ($field) use($stats) {
             return $stats[$field];
         }, $fields);
     }
     ksort($rows);
     $table->addRows($rows);
     if ($this->lineCount) {
         // move back to the beginning
         $output->write("[0G");
         $output->write(sprintf("[%dA", $this->lineCount));
         // overwrite the complete table before rendering the new one
         $width = $this->getApplication()->getTerminalDimensions()[0];
         $lines = array_fill(0, $this->lineCount, str_pad('', $width, ' '));
         $output->writeln($lines);
         $output->write(sprintf("[%dA", $this->lineCount));
     }
     // render the new table
     $table->render();
     // top table border + header + header border + bottom table border = 4
     $this->lineCount = 4 + sizeof($rows);
 }
开发者ID:treehouselabs,项目名称:worker-bundle,代码行数:40,代码来源:ListCommand.php

示例7: renderConfig

 protected function renderConfig(OutputInterface $output, array $config)
 {
     $table = new Table($output);
     $rows = array_map(function ($a, $b) {
         return [$a, $b];
     }, array_keys($config), $config);
     $table->addRows($rows);
     $table->render();
 }
开发者ID:php-pm,项目名称:php-pm,代码行数:9,代码来源:ConfigTrait.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     list($initTime1, $finishTime1) = $this->testThread();
     list($initTime2, $finishTime2) = $this->testPool();
     $table = new Table($output);
     $table->setHeaders(['Test', 'Start Time', 'Finish Time']);
     $table->addRows([['Thread', $initTime1, $finishTime1], ['Pool', $initTime2, $finishTime2]]);
     $table->render();
 }
开发者ID:borro,项目名称:tests,代码行数:9,代码来源:PThreadsCommand.php

示例9: renderClassesToDeFinalize

 /**
  * @param \ReflectionClass[] $classes
  * @param OutputInterface    $output
  */
 private function renderClassesToDeFinalize(array $classes, OutputInterface $output)
 {
     $tableHelper = new Table($output);
     if ($toDeFinalize = $this->getClassesToDeFinalize($classes)) {
         $output->writeln('<error>Following classes are final and need to be made extensible again:</error>');
         $tableHelper->addRows(array_map(function (\ReflectionClass $class) {
             return [$class->getName()];
         }, $toDeFinalize));
         $tableHelper->render();
     }
 }
开发者ID:ocramius,项目名称:finalizer,代码行数:15,代码来源:CheckFinalClassesCommand.php

示例10: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $stringLength = $input->getOption('string-length');
     $setIterationCount = $input->getArgument('set-count');
     $getIterationCount = $input->getArgument('get-count');
     $redisTest = new Redis($input->getOption('host'), $stringLength);
     $stats = $redisTest->test($setIterationCount, $getIterationCount);
     $table = new Table($output);
     $table->setHeaders(['Count', 'Length (bytes)', 'Type', 'Time (seconds)']);
     $table->addRows([[$setIterationCount, $stringLength, 'set', $stats['set']], [$getIterationCount, $stringLength, 'get', $stats['get']]]);
     $table->render();
 }
开发者ID:borro,项目名称:tests,代码行数:12,代码来源:RedisBenchmarkCommand.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->container->getDoctrine()->getManager($input->getOption('em'));
     $users = $em->getRepository('CmsAuthentication:Group')->findBy(array(), array('name' => 'ASC'));
     $table = new Table($output);
     $table->setHeaders(array('ID', 'Name', 'Super'));
     $table->addRows(array_map(function ($group) {
         /* @var $group Group */
         return array($group->getId(), $group->getName(), $group->isSuper() ? '<info>Yes</info>' : 'No');
     }, $users));
     $table->render();
 }
开发者ID:sitesupra,项目名称:sitesupra,代码行数:12,代码来源:GroupsListCommand.php

示例12: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->container->getDoctrine()->getManager($input->getOption('em'));
     $users = $em->getRepository('CmsAuthentication:User')->findBy(array(), array('login' => 'ASC'));
     $table = new Table($output);
     $table->setHeaders(array('ID', 'Login', 'Email', 'Groups', 'Active'));
     $table->addRows(array_map(function ($user) {
         /* @var $user User */
         return array($user->getId(), $user->getLogin(), $user->getEmail(), call_user_func(function ($value) {
             if ($value instanceof Group) {
                 return $value->getName();
             } else {
                 return '--/--';
             }
         }, $user->getGroup()), $user->isActive() ? '<info>Yes</info>' : 'No');
     }, $users));
     $table->render();
 }
开发者ID:sitesupra,项目名称:sitesupra,代码行数:18,代码来源:UsersListCommand.php

示例13: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $rating = $this->nflHandler->getRating();
     $output->writeln(sprintf("<info>Rating dates:: [%s - %s]</info>", $rating["start_date"], $rating["end_date"]));
     $table = new Table($output);
     $table->setHeaders(array('Game', 'Rating', 'Predict'))->setStyle('borderless')->addRow(array(new TableCell('<error>Finished games</error>', array('colspan' => 3))));
     $output->writeln("<error>Finished games</error>");
     foreach ($rating["finished"] as $game) {
         $table->addRow(array(sprintf("%s @ %s", $game["away_team"], $game["home_team"]), $game["gex"], $game["gex_predict"]));
     }
     $table->addRows(array(new TableSeparator(), array(new TableCell('<error>Future games</error>', array('colspan' => 3)))));
     $output->writeln("");
     $output->writeln("<error>Future games</error>");
     foreach ($rating["future"] as $game) {
         $table->addRow(array(sprintf("%s @ %s", $game["away_team"], $game["home_team"]), "", $game["gex_predict"]));
     }
     $table->render();
 }
开发者ID:sbabych,项目名称:nfl.server,代码行数:18,代码来源:RatingCommand.php

示例14: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $keys = $this->getClient()->getSshKeys();
     if (empty($keys)) {
         $this->stdErr->writeln("You do not yet have any SSH public keys in your Platform.sh account");
     } else {
         $this->stdErr->writeln("Your SSH keys are:");
         $table = new Table($output);
         $headers = array('ID', 'Title', 'Fingerprint');
         $rows = array();
         foreach ($keys as $key) {
             $rows[] = array($key['key_id'], $key['title'], $key['fingerprint']);
         }
         $table->setHeaders($headers);
         $table->addRows($rows);
         $table->render();
     }
     $this->stdErr->writeln('');
     $this->stdErr->writeln("Add a new SSH key by running <info>platform ssh-key:add [path]</info>");
     $this->stdErr->writeln("Delete an SSH key by running <info>platform ssh-key:delete [id]</info>");
 }
开发者ID:joshmiller83,项目名称:platformsh-cli,代码行数:21,代码来源:SshKeyListCommand.php

示例15: addRows

 public function addRows(array $rows)
 {
     $this->table->addRows($rows);
     return $this;
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:5,代码来源:TableHelper.php


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