當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SymfonyStyle::choice方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Style\SymfonyStyle::choice方法的典型用法代碼示例。如果您正苦於以下問題:PHP SymfonyStyle::choice方法的具體用法?PHP SymfonyStyle::choice怎麽用?PHP SymfonyStyle::choice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Style\SymfonyStyle的用法示例。


在下文中一共展示了SymfonyStyle::choice方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getStop

 private function getStop($value, $question = 'Which station ?')
 {
     $stops = $this->cff->getStop($value, false);
     if ($stops[0]['value'] != $value) {
         $values = array_column($stops, 'value');
         $value = $this->io->choice($question, $values, $stops[0]['value']);
         $key = array_search($value, $values);
         return $stops[$key];
     }
     return $stops[0];
 }
開發者ID:maidmaid,項目名稱:cffie,代碼行數:11,代碼來源:QueryCommand.php

示例2: selectBundle

 /**
  * @param Bundle[] $bundles
  *
  * @return Bundle|null
  */
 private function selectBundle(array $bundles)
 {
     $packageNames = array_map(function (Bundle $bundle) {
         return $bundle->getName();
     }, $bundles);
     $selectedName = $this->io->choice('Please select the package, where you want to place the Migration file', $packageNames, $this->getContainer()->getParameter('campaignchain_update.diff_package'));
     $this->io->text('You have selected: ' . $selectedName);
     $selectedBundle = null;
     foreach ($bundles as $bundle) {
         if ($bundle->getName() != $selectedName) {
             continue;
         }
         $selectedBundle = $bundle;
         break;
     }
     return $selectedBundle;
 }
開發者ID:campaignchain,項目名稱:update,代碼行數:22,代碼來源:GenerateBase.php

示例3: execute

 /**
  * @inheritDoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $helper = new SymfonyStyle($input, $output);
     $helper->title('Doctrine');
     $choices = [self::ACTION_DATABASE_IMPORT => 'Import database from remote host'];
     $todo = $helper->choice('Select action', $choices);
     $helper->newLine(4);
     $helper->section($choices[$todo]);
     $this->executeChoice($helper, $todo);
     CommandUtility::writeFinishedMessage($helper, self::NAME);
 }
開發者ID:pmdevelopment,項目名稱:tool-bundle,代碼行數:14,代碼來源:DoctrineCommand.php

示例4: execute

 /**
  * @inheritDoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $helper = new SymfonyStyle($input, $output);
     $helper->title('FOSUserBundle');
     $choices = [self::ACTION_PASSWORD_REPLACE => 'Replace all passwords (be careful!)'];
     $todo = $helper->choice('Select action', $choices);
     $helper->newLine(4);
     $helper->section($choices[$todo]);
     $this->executeChoice($helper, $todo);
     CommandUtility::writeFinishedMessage($helper, self::NAME);
 }
開發者ID:pmdevelopment,項目名稱:tool-bundle,代碼行數:14,代碼來源:FOSUserCommand.php

示例5: interact

 /**
  * {@inheritdoc}
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     // --title option
     if (!$input->getOption('title')) {
         $input->setOption('title', $io->ask('Enter the title of the page'));
     }
     // --extension option
     if (!$input->getOption('extension')) {
         $input->setOption('extension', $io->choice('Which file extension?', ['md', 'html.twig', 'twig', 'html']));
     }
     // --fieldname option
     if (!$input->getOption('filename')) {
         $input->setOption('filename', $io->ask('Enter the name of the file', str_replace(' ', self::FILENAME_SEPARATOR, strtolower($input->getOption('title'))) . '.' . $input->getOption('extension')));
     }
 }
開發者ID:opdavies,項目名稱:sculpin-content-generator-bundle,代碼行數:19,代碼來源:NewPageCommand.php

示例6: findProperServiceName

 private function findProperServiceName(InputInterface $input, SymfonyStyle $io, ContainerBuilder $builder, $name)
 {
     if ($builder->has($name) || !$input->isInteractive()) {
         return $name;
     }
     $matchingServices = $this->findServiceIdsContaining($builder, $name);
     if (empty($matchingServices)) {
         throw new \InvalidArgumentException(sprintf('No services found that match "%s".', $name));
     }
     $default = 1 === count($matchingServices) ? $matchingServices[0] : null;
     return $io->choice('Select one of the following services to display its information', $matchingServices, $default);
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:12,代碼來源:ContainerDebugCommand.php

示例7: selectWorkingLocale

 private function selectWorkingLocale()
 {
     $this->workingLocale = $this->formatter->choice('What locale would you like to configure', $this->getInstallableLocale());
 }
開發者ID:forkcms,項目名稱:forkcms,代碼行數:4,代碼來源:EnableLocaleCommand.php

示例8: function

<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure questions do not output anything when input is non-interactive
return function (InputInterface $input, OutputInterface $output) {
    $output = new SymfonyStyle($input, $output);
    $output->title('Title');
    $output->askHidden('Hidden question');
    $output->choice('Choice question with default', array('choice1', 'choice2'), 'choice1');
    $output->confirm('Confirmation with yes default', true);
    $output->text('Duis aute irure dolor in reprehenderit in voluptate velit esse');
};
開發者ID:neteasy-work,項目名稱:hkgbf_crm,代碼行數:14,代碼來源:command_7.php


注:本文中的Symfony\Component\Console\Style\SymfonyStyle::choice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。