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


PHP SymfonyStyle::listing方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $show_installed = !$input->getOption('available');
     $installed = $available = array();
     foreach ($this->load_migrations() as $name) {
         if ($this->migrator->migration_state($name) !== false) {
             $installed[] = $name;
         } else {
             $available[] = $name;
         }
     }
     if ($show_installed) {
         $io->section($this->user->lang('CLI_MIGRATIONS_INSTALLED'));
         if (!empty($installed)) {
             $io->listing($installed);
         } else {
             $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
             $io->newLine();
         }
     }
     $io->section($this->user->lang('CLI_MIGRATIONS_AVAILABLE'));
     if (!empty($available)) {
         $io->listing($available);
     } else {
         $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
         $io->newLine();
     }
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:29,代码来源:list_command.php

示例2: printMiddlewares

 private function printMiddlewares()
 {
     if (!$this->configuration->getMiddlewares()) {
         return;
     }
     $this->title('Middlewares');
     $this->output->listing($this->configuration->getMiddlewares());
 }
开发者ID:madewithlove,项目名称:glue,代码行数:8,代码来源:ConfigurationCommand.php

示例3: executeLocked

 /**
  * {@inheritdoc}
  */
 protected function executeLocked(InputInterface $input, OutputInterface $output)
 {
     $this->fs = new Filesystem();
     $this->io = new SymfonyStyle($input, $output);
     $this->rootDir = dirname($this->getContainer()->getParameter('kernel.root_dir'));
     $this->addEmptyDirs();
     $this->addIgnoredDirs();
     if (!empty($this->rows)) {
         $this->io->newLine();
         $this->io->listing($this->rows);
     }
     $this->addInitializePhp();
     return 0;
 }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:17,代码来源:InstallCommand.php

示例4: execute

 /**
  * Executes the command reparser:list
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return integer
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->section($this->user->lang('CLI_DESCRIPTION_REPARSER_AVAILABLE'));
     $io->listing($this->reparser_names);
     return 0;
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:14,代码来源:list_all.php

示例5: updateCode

 /**
  * @param SymfonyStyle|null $io
  */
 public function updateCode(SymfonyStyle $io = null)
 {
     $io->title('CampaignChain Data Update');
     if (empty($this->versions)) {
         $io->warning('No code updater Service found, maybe you didn\'t enable a bundle?');
         return;
     }
     $io->comment('The following data versions will be updated');
     $migratedVersions = array_map(function (DataUpdateVersion $version) {
         return $version->getVersion();
     }, $this->em->getRepository('CampaignChainUpdateBundle:DataUpdateVersion')->findAll());
     $updated = false;
     foreach ($this->versions as $version => $class) {
         if (in_array($version, $migratedVersions)) {
             continue;
         }
         $io->section('Version ' . $class->getVersion());
         $io->listing($class->getDescription());
         $io->text('Begin data update');
         $result = $class->execute($io);
         if ($result) {
             $dbVersion = new DataUpdateVersion();
             $dbVersion->setVersion($version);
             $this->em->persist($dbVersion);
             $this->em->flush();
             $io->text('Data update finished');
         }
         $updated = true;
     }
     if (!$updated) {
         $io->success('All data is up to date.');
     } else {
         $io->success('Every data version has been updated.');
     }
 }
开发者ID:campaignchain,项目名称:update,代码行数:38,代码来源:DataUpdateService.php

示例6: interact

 /**
  * If the user does not specify the $name parameter, then we will
  * prompt for it here.
  *
  * @hook interact
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  */
 public function interact(InputInterface $input, OutputInterface $output)
 {
     $available_art = $this->availableArt();
     $io = new SymfonyStyle($input, $output);
     $art_name = $input->getArgument('name');
     if (!$art_name) {
         $io->title('Available Art');
         $io->listing($available_art);
     }
 }
开发者ID:pantheon-systems,项目名称:terminus,代码行数:19,代码来源:ArtCommand.php

示例7: summarizeCommits

 /**
  * Summarize changes since last tag.
  */
 protected function summarizeCommits()
 {
     $last = $this->changelog->getLastRelease();
     if (!$last) {
         return;
     }
     $commits = $this->executeQuietly(['git', 'log', $last['name'] . '..HEAD', '--oneline']);
     $commits = explode(PHP_EOL, trim($commits));
     if (!$commits) {
         $this->output->writeln('Commits since <comment>' . $last['name'] . '</comment>:');
         $this->output->listing($commits);
     }
 }
开发者ID:Anahkiasen,项目名称:versioner,代码行数:16,代码来源:Versioner.php

示例8: showLocaleOverview

 private function showLocaleOverview()
 {
     $locale = array_map(function ($locale, $key) {
         $enabledMessage = null;
         $interfaceMessage = null;
         if ($this->defaultEnabledLocale === $key) {
             $enabledMessage = ' (default)';
         }
         if ($this->defaultInterfaceLocale === $key) {
             $interfaceMessage = ' (default)';
         }
         return ['key' => $key, 'locale' => $locale, 'installed' => array_key_exists($key, $this->installedLocale) ? 'Y' : 'N', 'interface' => (array_key_exists($key, $this->interfaceLocale) ? 'Y' : 'N') . $interfaceMessage, 'enabled' => (array_key_exists($key, $this->enabledLocale) ? 'Y' : 'N') . $enabledMessage, 'redirect' => array_key_exists($key, $this->redirectLocale) ? 'Y' : 'N'];
     }, $this->getInstallableLocale(), array_keys($this->getInstallableLocale()));
     $this->formatter->listing(["key:\t\tThe identifier of the locale", "locale:\tThe name of the locale", "installed:\tPossible locale to use as interface, enabled or redirect locale", "interface:\tLocale that the user in the backend can use for the interface", "enabled:\tLocale that are accessible for visitors", "redirect:\tLocale that people may automatically be redirected to based upon their browser locale"]);
     $this->formatter->table(['key', 'locale', 'installed', 'interface', 'enabled', 'redirect'], $locale);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:16,代码来源:EnableLocaleCommand.php

示例9: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $file = $input->getOption('config') ?: sprintf('%s/pbjc.yml', getcwd());
     if (!file_exists($file)) {
         $io->error(sprintf('File "%s" does not exists.', $file));
         return;
     }
     $parser = new Parser();
     $data = $parser->parse(file_get_contents($file));
     if (!is_array($data['namespaces'])) {
         $data['namespaces'] = [$data['namespaces']];
     }
     $io->title('Generated files for namespaces:');
     $io->listing($data['namespaces']);
     // output callback
     $callback = function (OutputFile $file) use($io) {
         $io->text($file->getFile());
         if (!is_dir(dirname($file->getFile()))) {
             mkdir(dirname($file->getFile()), 0777, true);
         }
         file_put_contents($file->getFile(), $file->getContents());
     };
     $languages = [];
     if (isset($data['languages'])) {
         $languages = $data['languages'];
         unset($data['languages']);
     }
     $compile = new Compiler();
     foreach ($languages as $language => $options) {
         if ($input->getOption('language') && $input->getOption('language') != $language) {
             continue;
         }
         $options = array_merge($data, $options, ['callback' => $callback]);
         try {
             $io->section($language);
             $compile->run($language, new CompileOptions($options));
             $io->success("👍");
             //thumbs-up-sign
         } catch (\Exception $e) {
             $io->error($e->getMessage());
         }
     }
 }
开发者ID:gdbots,项目名称:pbj,代码行数:47,代码来源:CompileCommand.php

示例10: displayResults

 /**
  * Displays a security report as plain text.
  *
  * @param OutputInterface $output
  * @param string          $lockFilePath    The file path to the checked lock file
  * @param array           $vulnerabilities An array of vulnerabilities
  */
 public function displayResults(OutputInterface $output, $lockFilePath, array $vulnerabilities)
 {
     $output = new SymfonyStyle(new ArrayInput(array()), $output);
     $output->title('Symfony Security Check Report');
     $output->comment(sprintf('Checked file: <comment>%s</>', realpath($lockFilePath)));
     if ($count = count($vulnerabilities)) {
         $output->error(sprintf('%d packages have known vulnerabilities.', $count));
     } else {
         $output->success('No packages have known vulnerabilities.');
     }
     if (0 !== $count) {
         foreach ($vulnerabilities as $dependency => $issues) {
             $output->section(sprintf('%s (%s)', $dependency, $issues['version']));
             $details = array_map(function ($value) {
                 return sprintf("<info>%s</>: %s\n   %s", $value['cve'] ?: '(no CVE ID)', $value['title'], $value['link']);
             }, $issues['advisories']);
             $output->listing($details);
         }
     }
     $output->note('This checker can only detect vulnerabilities that are referenced in the SensioLabs security advisories database. Execute this command regularly to check the newly discovered vulnerabilities.');
 }
开发者ID:sensiolabs,项目名称:security-checker,代码行数:28,代码来源:TextFormatter.php

示例11: install

 /**
  * @param SymfonyStyle|null $io
  * @param bool              $updateDatabase
  *
  * @return bool
  *
  * @throws \Doctrine\DBAL\ConnectionException
  * @throws \Exception
  */
 public function install(SymfonyStyle $io = null)
 {
     $this->logger->info('START: MODULES INSTALLER');
     $newBundles = $this->bundleConfigService->getNewBundles();
     if (empty($newBundles)) {
         if ($io) {
             $io->success('No new modules found.');
         }
         $this->logger->info('No new modules found.');
         $this->logger->info('END: MODULES INSTALLER');
         return false;
     }
     // Increase timeout limit to run this script.
     set_time_limit(240);
     $this->kernelService->parseBundlesForKernelConfig($newBundles);
     $loggerResult = '';
     $this->em->getConnection()->beginTransaction();
     $this->registerDistribution();
     try {
         foreach ($newBundles as $newBundle) {
             switch ($newBundle->getType()) {
                 case 'campaignchain-core':
                     break;
                 case 'campaignchain-hook':
                     // TODO: new vs. update
                     $this->registerHook($newBundle);
                     break;
                 case 'campaignchain-symfony':
                     $this->registerSymfonyBundle($newBundle);
                     break;
                 default:
                     $this->registerModule($newBundle);
                     break;
             }
             $loggerResult .= $newBundle->getName() . ', ';
             $this->em->persist($newBundle);
         }
         $this->em->flush();
         // Store the campaign types a campaign can be copied to.
         $this->registerCampaignConversions();
         // Store the channels related to an activity or Location.
         $this->registerChannelRelationships();
         // Store the system parameters injected by modules.
         $this->registerModuleSystemParams();
         // Register any new Bundles in the Symfony kernel.
         $this->kernelService->register();
         $this->em->getConnection()->commit();
     } catch (\Exception $e) {
         $this->em->getConnection()->rollBack();
         if ($io) {
             $io->error('Error at update: ' . $e->getMessage());
         }
         $this->logger->error('Error: ' . $e->getMessage());
         $this->logger->info('END: MODULES INSTALLER');
         throw $e;
     }
     $this->logger->info('Installed/updated modules: ' . rtrim($loggerResult, ', '));
     if ($io) {
         $io->section('Installed/updated modules:');
         $io->listing(explode(', ', rtrim($loggerResult, ', ')));
     }
     $this->logger->info('END: MODULES INSTALLER');
     return true;
 }
开发者ID:CampaignChain,项目名称:core,代码行数:73,代码来源:Installer.php

示例12: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $twig = $this->getTwigEnvironment();
     if (null === $twig) {
         $io->error('The Twig environment needs to be set.');
         return 1;
     }
     $types = array('functions', 'filters', 'tests', 'globals');
     if ($input->getOption('format') === 'json') {
         $data = array();
         foreach ($types as $type) {
             foreach ($twig->{'get' . ucfirst($type)}() as $name => $entity) {
                 $data[$type][$name] = $this->getMetadata($type, $entity);
             }
         }
         $data['tests'] = array_keys($data['tests']);
         $io->writeln(json_encode($data));
         return 0;
     }
     $filter = $input->getArgument('filter');
     foreach ($types as $index => $type) {
         $items = array();
         foreach ($twig->{'get' . ucfirst($type)}() as $name => $entity) {
             if (!$filter || false !== strpos($name, $filter)) {
                 $items[$name] = $name . $this->getPrettyMetadata($type, $entity);
             }
         }
         if (!$items) {
             continue;
         }
         $io->section(ucfirst($type));
         ksort($items);
         $io->listing($items);
     }
     return 0;
 }
开发者ID:Gladhon,项目名称:symfony,代码行数:37,代码来源:DebugCommand.php

示例13: function

<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
// Ensure has proper line ending before outputing a text block like with SymfonyStyle::listing() or SymfonyStyle::text()
return function (InputInterface $input, OutputInterface $output) {
    $output = new SymfonyStyle($input, $output);
    $output->writeln('Lorem ipsum dolor sit amet');
    $output->listing(array('Lorem ipsum dolor sit amet', 'consectetur adipiscing elit'));
    // Even using write:
    $output->write('Lorem ipsum dolor sit amet');
    $output->listing(array('Lorem ipsum dolor sit amet', 'consectetur adipiscing elit'));
    $output->write('Lorem ipsum dolor sit amet');
    $output->text(array('Lorem ipsum dolor sit amet', 'consectetur adipiscing elit'));
};
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:16,代码来源:command_5.php

示例14: 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
  *
  * @see setCode()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $styleHelper = new SymfonyStyle($input, $output);
     $validatorFactory = new ValidatorFactoryImplementation();
     $validators = $validatorFactory->getMessageValidator();
     $commitMessage = file_get_contents($input->getArgument(self::ARGUMENT_COMMIT_MESSAGE_FILE));
     $commentCharacter = $input->getOption(self::OPTION_COMMENT_CHAR);
     $ignorePatterns = $input->getOption(self::OPTION_IGNORE);
     foreach ($ignorePatterns as $ignorePattern) {
         if (preg_match($ignorePattern, $commitMessage)) {
             return 0;
         }
     }
     $safeCommitMessage = preg_replace('/' . preg_quote($commentCharacter) . '.*/', '', $commitMessage);
     $message = new MessageImplementation($safeCommitMessage);
     $validators->validate($message);
     if (count($message->getStatuses()) < 1) {
         return 0;
     }
     $statusList = [];
     $isPositive = true;
     /** @var Status $status */
     foreach ($message->getStatuses() as $status) {
         $statusList[] = $status->getMessage() . ' (' . $status->getDetailsUrl() . ')';
         $isPositive = $status->isPositive() && $isPositive;
     }
     if ($isPositive) {
         return 0;
     }
     $styleHelper->error('Incorrectly formatted commit message');
     $styleHelper->listing($statusList);
     $styleHelper->section('Your Commit Message');
     $styleHelper->block($commitMessage);
     $styleHelper->warning('A commit has not been created');
     return 1;
 }
开发者ID:purplebooth,项目名称:git-lint-validators,代码行数:51,代码来源:Hook.php

示例15: updateSchema

 private function updateSchema(SymfonyStyle $io, $queries)
 {
     $io->caution("Your database schema needs to be updated. The following queries will be run:");
     $io->listing($queries);
     if ($this->updateDb === false && $io->confirm("Should we run this queries now?", false) === false) {
         return;
     }
     $cmdOutput = new BufferedOutput();
     $command = $this->getApplication()->find('doctrine:schema:update');
     $force = new ArrayInput(array('--env' => 'dev', '--dump-sql' => true, '--force' => true));
     $command->run($force, $cmdOutput);
     $result = $cmdOutput->fetch();
     if (strstr($result, 'Database schema updated successfully!') === false) {
         $io->error("Couldn't update the schema. Run 'doctrine:schema:update' separately to find out why");
     }
     $io->success("Database schema updated successfully!");
     $this->clearMetadata($io);
 }
开发者ID:redelivre,项目名称:login-cidadao,代码行数:18,代码来源:DeployCommand.php


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