當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。