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


PHP Table::setRows方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $table = new Table($output);
     $table->setStyle('compact');
     $environment = $input->getArgument('environment');
     if (in_array($environment, array('dev', 'prod'))) {
         $loadedConfigurations = $this->loadConfigurations($environment);
     } else {
         $output->writeln(' <error>' . $this->trans('commands.site.mode.messages.invalid-env') . '</error>');
     }
     $configurationOverrideResult = $this->overrideConfigurations($loadedConfigurations['configurations']);
     foreach ($configurationOverrideResult as $configName => $result) {
         $output->writeln(sprintf(' <info>%s:</info> <comment>%s</comment>', $this->trans('commands.site.mode.messages.configuration'), $configName));
         $table->setHeaders([$this->trans('commands.site.mode.messages.configuration-key'), $this->trans('commands.site.mode.messages.original'), $this->trans('commands.site.mode.messages.updated')]);
         $table->setRows($result);
         $table->render();
         $output->writeln('');
     }
     $servicesOverrideResult = $this->overrideServices($loadedConfigurations['services'], $output);
     if (!empty($servicesOverrideResult)) {
         $output->writeln(' <info>' . $this->trans('commands.site.mode.messages.new-services-settings') . '</info>');
         $table->setHeaders([$this->trans('commands.site.mode.messages.service'), $this->trans('commands.site.mode.messages.service-parameter'), $this->trans('commands.site.mode.messages.service-value')]);
         $table->setStyle('compact');
         $table->setRows($servicesOverrideResult);
         $table->render();
     }
     $this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
 }
开发者ID:legovaer,项目名称:DrupalConsole,代码行数:28,代码来源:ModeCommand.php

示例2: printRecievers

 /**
  * @param Reciever[] $recievers
  */
 public function printRecievers(array $recievers)
 {
     $this->table->setHeaders(['name', 'email']);
     $rows = [];
     foreach ($recievers as $reciever) {
         $rows[] = [$reciever->getFullName(), $reciever->getEmail()];
     }
     $this->table->setRows($rows);
     $this->table->render();
     $this->table->setRows([]);
 }
开发者ID:cinno,项目名称:massmailer-1,代码行数:14,代码来源:RecieverPrinter.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $job = $input->getArgument('job');
     $build = $input->getArgument('build') ? $input->getArgument('build') : 'lastBuild';
     $api = new Api();
     $res = $api->info($job, $build);
     $rows = [];
     $parameters = [];
     if (isset($res['actions'][0]['parameters']) && is_array($res['actions'][0]['parameters'])) {
         foreach ($res['actions'][0]['parameters'] as $parameter) {
             $parameters[] = implode('=', $parameter);
         }
         $rows[] = ['Parameters', implode("\n", $parameters)];
     }
     foreach ($res as $key => $value) {
         if (is_scalar($value) || is_null($value)) {
             $rows[] = [$key, $value];
         } else {
             $rows[] = [$key, substr(json_encode($value), 0, 100) . '...'];
         }
     }
     $table = new Table($output);
     $table->setRows($rows);
     $table->render();
 }
开发者ID:AOEpeople,项目名称:JenkinsCli,代码行数:25,代码来源:InfoCommand.php

示例4: execute

 /**
  * Execute the command.
  *
  * @param  \Symfony\Component\Console\Input\InputInterface  $input
  * @param  \Symfony\Component\Console\Output\OutputInterface  $output
  * @return void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $mod = new ModLib($input->getArgument('mod'));
     $table = new Table($output);
     $table->setRows(array(array('Mod Name', $mod->name), array('Mod Slug', $mod->slug), array('Mod Version', $mod->version), array('MC Version', $mod->mcversion)));
     $table->render();
 }
开发者ID:indemnity83,项目名称:mcmod,代码行数:14,代码来源:InfoCommand.php

示例5: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Allow special date param in the form of _1 for back one day, _2 for two
     // days etc.
     $date = $input->getArgument('date');
     if (preg_match('/_(\\d+)/', $date, $matches)) {
         $date = date('Y-m-d', time() - 86400 * $matches[1]);
     }
     $data = $this->repository->status($date);
     $table = new Table($output);
     $table->setHeaders(['Slot', 'JobId', 'Time', 'Title']);
     $rows = [];
     $total = 0;
     foreach ($data as $record) {
         $total += $record->duration;
         $details = $this->connector->ticketDetails($record->tid);
         if (!empty($record->active)) {
             $record->tid .= ' *';
         }
         $rows[] = [$record->id, $record->tid, Formatter::formatDuration($record->duration), $details->getTitle()];
     }
     $rows[] = new TableSeparator();
     $rows[] = ['', '<comment>Total</comment>', '<info>' . Formatter::formatDuration($total) . '</info>', ''];
     $table->setRows($rows);
     $table->render();
 }
开发者ID:nickschuch,项目名称:tl,代码行数:29,代码来源:Status.php

示例6: execute

 /**
  * Execute command
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return bool
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $quiet = $output->getVerbosity() == OutputInterface::VERBOSITY_QUIET;
     $verbose = $output->getVerbosity() == OutputInterface::VERBOSITY_VERBOSE;
     if (!$quiet) {
         $output->write('<info>' . $this->getApplication()->getName() . '</info>');
         $output->write(' version <comment>' . $this->getApplication()->getVersion() . '</comment> ');
         $output->writeln("by J.Ginés Hernández G. <jgines@gmail.com>\n");
     }
     $sourcePath = $input->getArgument('source');
     $destPath = $input->getArgument('dest');
     $formatType = $input->getOption('format');
     $sortImg = new PhotoSort($verbose);
     $items = $sortImg->copy($sourcePath, $destPath, $formatType);
     if ($verbose) {
         if (count($items)) {
             $table = new Table($output);
             $table->setHeaders(array('Old File', 'New File'));
             $table->setRows($items);
             $table->render();
         }
         $output->writeln("\nCheers!\n");
     }
     return true;
 }
开发者ID:ginsen,项目名称:photosort,代码行数:33,代码来源:dirCopyCommand.php

示例7: fire

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        /** @var $plugin PluginBootstrap */
        \PluginManager::sync();
        if ($collection = \PluginManager::getPluginCollection() and count($collection) > 0) {
            /** @var Table $table */
            $table = new Table($this->getOutput());
            $table->setHeaders(['name', 'version', 'description', 'active', 'installed']);
            $rows = [];
            foreach ($collection as $plugin) {
                $rows[] = [$plugin->getName(), $plugin->getVersion(), $plugin->getDescription(), $plugin->isActive() ? 'yes' : 'no', $plugin->isInstalled() ? 'yes' : 'no'];
            }
            $table->setRows($rows);
            $table->render();
        } else {
            $line = <<<EVO
<info>no plugins avalaible</info>
EVO;
            $this->line($line);
        }
        /*$this->line(<<<EOF
        The <info>%command.name%</info> command lists all commands:
        
            <info>php %command.full_name%</info>
        
        You can also display the commands for a specific namespace:
        EOF
        );*/
        //$this->line('Alle Plugins.asdkjashdkash');
    }
开发者ID:lava83,项目名称:lavaproto,代码行数:35,代码来源:PluginList.php

示例8: printTable

 private function printTable(array $headers, array $rows, OutputInterface $output)
 {
     $table = new Table($output);
     $table->setHeaders($headers);
     $table->setRows($rows);
     $table->render();
 }
开发者ID:lulco,项目名称:phoenix,代码行数:7,代码来源:StatusCommand.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getArgument('config_file') ? $input->getArgument('config_file') : $this->configDefaultPath;
     $output->writeln('Linting <info>' . basename($path) . '</info>...');
     if (!is_file($path)) {
         throw new \InvalidArgumentException('"' . $path . '" is not a file.');
     } elseif (!is_readable($path)) {
         throw new \InvalidArgumentException('"' . $path . '" can not be read.');
     }
     $verifyLogFiles = $input->getOption('check-files');
     if ($verifyLogFiles) {
         $output->writeln('<comment>Also checking if the log files can be accessed.</comment>');
     }
     $output->writeln('');
     $lint = Config::lint(file_get_contents($path), $verifyLogFiles);
     $checkLines = [];
     foreach ($lint['checks'] as $check) {
         $checkLines = $this->prepareCheckLine($checkLines, $check);
     }
     $output->writeln('Checks:');
     $table = new Table($output);
     $table->setStyle('compact');
     $table->setRows($checkLines);
     $table->render();
     $output->writeln('');
     if ($lint['valid']) {
         $output->writeln('<fg=green>Your config file is valid.</>');
     } else {
         $output->writeln('<error> Your config file is not valid. </error>');
     }
 }
开发者ID:syonix,项目名称:log-viewer-lib,代码行数:31,代码来源:LintCommand.php

示例10: execute

 /**
  * Executes the current command.
  *
  * This method is not abstract because you can use this class
  * as a concrete class. In this case, instead of defining the
  * execute() method, you set the code to execute by passing
  * a Closure to the setCode() method.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return null|int null or 0 if everything went fine, or an error code
  *
  * @throws \LogicException When this abstract method is not implemented
  *
  * @see setCode()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var DefinitionChecker $checker */
     $checker = $this->getContainer()->get('babymarkt_ext_cron.service.definitionchecker');
     $checker->setApplication($this->getApplication());
     /** @var Definition[] $definitions */
     $definitions = $this->getContainer()->getParameter('babymarkt_ext_cron.definitions');
     $errorFound = false;
     if (count($definitions)) {
         $resultList = [];
         foreach ($definitions as $alias => $definition) {
             $definition = new Definition($definition);
             if ($definition->isDisabled()) {
                 $resultList[] = ['alias' => $alias, 'command' => $definition->getCommand(), 'result' => '<comment>Disabled</comment>'];
             } else {
                 if (!$checker->check($definition)) {
                     $resultList[] = ['alias' => $alias, 'command' => $definition->getCommand(), 'result' => '<error>' . $checker->getResult() . '</error>'];
                     $errorFound = true;
                 } else {
                     $resultList[] = ['alias' => $alias, 'command' => $definition->getCommand(), 'result' => '<info>OK</info>'];
                 }
             }
         }
         $table = new Table($output);
         $table->setHeaders(['Alias', 'Command', 'Result']);
         $table->setRows($resultList);
         $table->render();
     } else {
         $output->writeln('<comment>No cron job definitions found.</comment>');
     }
     return (int) $errorFound;
 }
开发者ID:Baby-Markt,项目名称:CronBundle,代码行数:49,代码来源:ValidateCommand.php

示例11: binaryInstallWindows

 /**
  * @param string          $path
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function binaryInstallWindows($path, InputInterface $input, OutputInterface $output)
 {
     $php = Engine::factory();
     $table = new Table($output);
     $table->setRows([['<info>' . $php->getName() . ' Path</info>', $php->getPath()], ['<info>' . $php->getName() . ' Version</info>', $php->getVersion()], ['<info>Compiler</info>', $php->getCompiler()], ['<info>Architecture</info>', $php->getArchitecture()], ['<info>Thread safety</info>', $php->getZts() ? 'yes' : 'no'], ['<info>Extension dir</info>', $php->getExtensionDir()], ['<info>php.ini</info>', $php->getIniPath()]])->render();
     $inst = Install::factory($path);
     $progress = $this->getHelperSet()->get('progress');
     $inst->setProgress($progress);
     $inst->setInput($input);
     $inst->setOutput($output);
     $inst->install();
     $deps_handler = new Windows\DependencyLib($php);
     $deps_handler->setProgress($progress);
     $deps_handler->setInput($input);
     $deps_handler->setOutput($output);
     $helper = $this->getHelperSet()->get('question');
     $cb = function ($choices) use($helper, $input, $output) {
         $question = new ChoiceQuestion('Multiple choices found, please select the appropriate dependency package', $choices);
         $question->setMultiselect(false);
         return $helper->ask($input, $output, $question);
     };
     foreach ($inst->getExtDllPaths() as $dll) {
         if (!$deps_handler->resolveForBin($dll, $cb)) {
             throw new \Exception('Failed to resolve dependencies');
         }
     }
 }
开发者ID:jingdor,项目名称:pickle,代码行数:32,代码来源:InstallerCommand.php

示例12: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln("<comment>Watch out: only @Cache annotation and cache defined in routing are showned here.\nIf you set manually the cache via \$response->setPublic(true), it will appear here as private</comment>");
     $output->writeln("<comment>If so, you may want to use the @CacheMayBe annotation</comment>");
     $routes = $this->getContainer()->get('router')->getRouteCollection();
     $table = new Table($output);
     $table->setHeaders(['route + pattern', 'private', 'ttl']);
     $rows = [];
     $first = true;
     foreach ($routes as $route => $routeInfo) {
         $this->route = $route;
         $isPublic = $this->isRoutePublic($routeInfo);
         $hidePrivate = $input->getOption('only-public');
         $forcedRoute = $input->getArgument('route');
         $sameAsForcedRoute = $input->getArgument('route') === $route;
         if ($forcedRoute && $sameAsForcedRoute || !$forcedRoute && ($isPublic || !$hidePrivate)) {
             if ($first) {
                 $first = false;
             } else {
                 $rows[] = new TableSeparator();
             }
             $rows[] = ['<info>' . $route . "</info>\n" . $routeInfo->getPattern(), $this->routePublicText($routeInfo), $this->formatTtl($this->getTtl($routeInfo))];
         }
     }
     $table->setRows($rows);
     $table->render();
 }
开发者ID:mapado,项目名称:cache-info-bundle,代码行数:27,代码来源:HttpCacheListCommand.php

示例13: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Set filters & get data
     $type = $input->getArgument(self::TYPE_ARGUMENT);
     if ($type) {
         $this->productlist->setType($type);
     }
     $active = $input->getOption(self::ACTIVE_OPTION);
     if ($active) {
         $this->productlist->setStatus(1);
     }
     $products = $this->productlist->getProducts();
     // If only count, return it
     if ($input->getOption(self::COUNT_OPTION)) {
         return $output->writeln(sprintf('Count: %d', $products->getTotalCount()));
     }
     // Else prepare data for showing
     $types = $this->productlist->getProductTypesAssoc();
     $rows = new \ArrayObject();
     foreach ($products->getItems() as $id => $product) {
         $rows->append([$product->getId(), $product->getSku(), $product->getName(), $types[$product->getTypeId()]]);
     }
     // Output table layout
     $table = new Table($output);
     $table->setHeaders(['ID', 'SKU', 'Name', 'Type']);
     $table->setRows($rows->getArrayCopy());
     $table->render();
 }
开发者ID:stefandoorn,项目名称:magento2-console-productlist,代码行数:31,代码来源:ProductlistCommand.php

示例14: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $source = $input->getArgument('source');
     if (is_dir($source) === false && is_file($source) === false) {
         throw new \InvalidArgumentException(sprintf('"%s" is not a file or a directory', $source));
     }
     $logger = new Logger($this->output, $input->getOption('debug'));
     if (is_dir($source) === true) {
         $collector = new DirectoryCodeCollector(array($source));
     } elseif (is_file($source) === true) {
         $collector = new FileCodeCollector(array($source));
     }
     foreach ($this->engine->convert($collector, $logger, $input->getArgument('file')) as $file) {
         $this->fileRender->render($file);
     }
     $table = new Table($this->output);
     $table->setHeaders(array(array(new TableCell('Incompatibility', array('colspan' => 4))), array('Type', 'Message', 'Line', 'Class')));
     $table->setRows($logger->getIncompatibility());
     $table->render();
     if ($input->getOption('v') === true) {
         $table = new Table($this->output);
         $table->setHeaders(array(array(new TableCell('Log', array('colspan' => 3))), array('Message', 'Line', 'Class')));
         $table->setRows($logger->getLogs());
         $table->render();
     }
 }
开发者ID:surjit,项目名称:php-to-zephir,代码行数:26,代码来源:Convert.php

示例15: execute

 /**
  * Execute the command
  *
  * @param InputInterface  $input  the user input
  * @param OutputInterface $output the command line output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $webfinger = new Net_WebFinger();
     // is http fallback enabled
     if ($input->getOption('insecure')) {
         $webfinger->fallbackToHttp = true;
     }
     $react = $webfinger->finger($input->getArgument("resource"));
     $output->writeln("<info>Data source URL: {$react->url}</info>");
     $output->writeln("<comment>Information secure: " . var_export($react->secure, true) . "</comment>");
     // check for errors
     if ($react->error !== null) {
         $this->displayError($react->error, $output);
         //return;
     }
     $helper = new \Lib\WebFingerHelper($react);
     // show profile
     $output->writeln("\n<info>Profile:</info>");
     $profile = $helper->getProfileTableView();
     $table = new Table($output);
     $table->setRows($profile);
     $table->setStyle('compact');
     $table->render();
     // show alternate identifier
     $output->writeln("\n<info>Alternate Identifier:</info>");
     foreach ($react->aliases as $alias) {
         $output->writeln(" * {$alias}");
     }
     // show links
     $output->writeln("\n<info>More Links:</info>");
     $links = $helper->getLinksTableView();
     $table = new Table($output);
     $table->setHeaders(array('Type', 'Link'))->setRows($links);
     $table->render();
 }
开发者ID:pfefferle,项目名称:webfinger-cli,代码行数:41,代码来源:WebFingerCommand.php


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