当前位置: 首页>>代码示例>>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;未经允许,请勿转载。